专做实习生招聘的网站,做网站的基本知识,怎么做提卡密网站,暂时关闭wordpressThickBox是一个基于JQuery的小组件#xff0c;用于提供像windows关机那样效果的网页的制作#xff0c;只有20K#xff0c;下载地址以及Demo在http://jquery.com/demo/thickbox/#xff0c;使用时共有6个文件需要下载#xff0c;它们是: jquery-latest.js loadingA… ThickBox是一个基于JQuery的小组件用于提供像windows关机那样效果的网页的制作只有20K下载地址以及Demo在http://jquery.com/demo/thickbox/使用时共有6个文件需要下载它们是: jquery-latest.js loadingAnimation.gif macFFBgHack.png thickbox.css thickbox.js thickbox-compressed.js (其中thickbox.js和thickbox.css里要指定另两个图片的位置) 准备好后下面开始用Jsp/Servlet编写一个ThickBox的小例子 1.欢迎页面 index.jsp
% page languagejava importjava.util.* pageEncodingISO-8859-1%
%
String path request.getContextPath();
String basePath request.getScheme()://request.getServerName():request.getServerPort()path/;
%!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
htmlheadbase href%basePath%script typetext/javascript srcjs/jquery.js/scriptscript typetext/javascript srcjs/thickbox.js/scripttitleTestThickBox/titlelink relstylesheet hrefcss/thickbox.css typetext/css mediascreen //headbodyh1a hrefLogin.jsp?keepThistrueTB_iframetrueheight150width300 classthickbox titleLoginClick to Login/a/h1br/body
/html里面重要的是?keepThistrueTB_iframetrueheight150width300其效果是上层的box带有标题栏并且点击Box以外的区域时返回原来状态。 (注意script typetext/javascript srcpath-to-file/jquery.js/scriptscript typetext/javascript srcpath-to-file/thickbox.js/script以及link relstylesheet hrefpath-to-file/thickbox.css typetext/css mediascreen /的位置) 2.LoginServlet
package MyServlet;import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;public class LoginServlet extends HttpServlet {protected void processRequest(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {response.setContentType(text/html;charsetUTF-8);PrintWriter out response.getWriter();try {String name request.getParameter(name);out.println(html);out.println(head);out.println(titleGreeting/title); out.println(/head);out.println(body);out.println(h1Hello name /h1);out.println(/body);out.println(/html);} finally { out.close();}} /** * Handles the HTTP codeGET/code method.* param request servlet request* param response servlet response* throws ServletException if a servlet-specific error occurs* throws IOException if an I/O error occurs*/Overrideprotected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {processRequest(request, response);} /** * Handles the HTTP codePOST/code method.* param request servlet request* param response servlet response* throws ServletException if a servlet-specific error occurs* throws IOException if an I/O error occurs*/Overrideprotected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {processRequest(request, response);}/** * Returns a short description of the servlet.* return a String containing servlet description*/Overridepublic String getServletInfo() {return Short description;}// /editor-fold}3.登录页面Login.jsp
% page languagejava importjava.util.* pageEncodingISO-8859-1%
%
String path request.getContextPath();
String basePath request.getScheme()://request.getServerName():request.getServerPort()path/;
%!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
htmlheadbase href%basePath%titleMy JSP Login.jsp starting page/title/headbodyform methodpost actionLoginServletp classSTYLE1Please input your name and click OK button. /ppinput typetext namenameinput namebuttonOk typesubmit idbuttonOk valueOK/p/formbr/body
/html4. 修改web.xml
?xml version1.0 encodingUTF-8?
web-app version2.5 xmlnshttp://java.sun.com/xml/ns/javaee xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsdservletdescriptionThis is the description of my J2EE component/descriptiondisplay-nameThis is the display name of my J2EE component/display-nameservlet-nameLoginServlet/servlet-nameservlet-classMyServlet.LoginServlet/servlet-class/servletservlet-mappingservlet-nameLoginServlet/servlet-nameurl-pattern/LoginServlet/url-pattern/servlet-mappingwelcome-file-listwelcome-fileindex.jsp/welcome-file/welcome-file-list
/web-app好啦 Tomcat部署下看看吧 页面: ThickBox: 点击OK后 最后列一下文件目录: