This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jar:3 | |
| jcaptcha-2.0-alpha-1-SNAPSHOT.jar | |
| jcaptcha-api-1.0.jar | |
| jcaptcha-integration-simple-servlet-2.0-alpha-1-SNAPSHOT.jar | |
| <form action="pay2" method="post"> | |
| <input type="hidden" name="token" value="${requestScope.request_token }"/> | |
| 输入支付金额:<input type="text" name="money"/><br> | |
| 请输入验证码:<input type="text" name="code" value=""/><br/> | |
| <img alt="验证码" src="/jcaptcha.jpg" id="img"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //token.servlet→jsp→servlet→jsp结果页 | |
| public class TokenUtil { | |
| public static void createToken(HttpServletRequest request,HttpServletResponse response){ | |
| UUID uuid = UUID.randomUUID(); | |
| String token = uuid.toString(); | |
| request.getSession().setAttribute("session_token",token); | |
| request.setAttribute("request_token", token); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //注意要点 | |
| //1.文件格式的设置 | |
| //2.文件名中中文的设置 | |
| //3.文件大小的设置 | |
| //4.设置一个相应的头 Servlet download file:搜 键:文件的描述 值:对应的文件 | |
| response.setContentType("application/pdf");//设置文件格式 | |
| String fileName = "第一章.pdf"; | |
| File file = new File("I:/test/upload","第一章.pdf");//下载文件的路径及名称 | |
| response.setContentLength(new Long(file.length()).intValue());//进度条的操作,提示完成进度 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //jar:ImageUtil.jar filters-2.0.235.jar | |
| //jquert.jcrop.js jcrop.css | |
| <img alt="" src="http://www.wdfx100.com/upload/${fileName }"> | |
| <form action="jcrop" method="post"> | |
| <input type="hidden" name="fileName" value="${fileName}"> | |
| <input type="hidden" name="x1" id="x"> | |
| <input type="hidden" name="y1" id="y"> | |
| <input type="hidden" name="x2" id="x2"> | |
| <input type="hidden" name="y2" id="y2"> | |
| <input type="submit" value="剪裁"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //commons.apache.org 下的一个组件 upload | |
| //jar:commons-fileupload-1.2.2.jar,依赖jar:commons-io-1.4.jar | |
| <form action="fileUpload" method="post" enctype="multipart/form-data"> | |
| 文件描述:<input type="text" name="filedesc"><br/> | |
| <input type="file" name="myfile"><br/> | |
| <input type="submit" value="提交"/> | |
| </form> | |
| if(ServletFileUpload.isMultipartContent(request)){//获取请求的方式改变 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //jar:commons-email-1.2 | |
| //1.5的javaee.jar下的mail文件删除,添加1.4的mail.jar | |
| //1、commons-email发送普通文本邮件 | |
| public static void sendSimpleEmail(String toEmailAddress,String subject,String msg){ | |
| Email email = new SimpleEmail(); | |
| email.setHostName("smtp.163.com");//发信件的邮件服务器 | |
| email.setAuthentication("wdfx100", "**********");//设置身份验证:用户名和密码 | |
| email.setCharset("UTF-8"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //jar:commons-dbcp-1.4 | |
| //依赖的jar:commons-pool-1.5.6 | |
| //第一种// | |
| private static BasicDataSource bd=null; | |
| static{ | |
| bd = new BasicDataSource(); | |
| bd.setDriverClassName(DIRVER); | |
| bd.setUrl(URL); | |
| bd.setUsername(NAME); | |
| bd.setPassword(PASSWORD); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DBhelp<T>{ | |
| final String DRIVER="com.mysql.jdbc.Driver"; | |
| final String URL="jdbc:mysql://127.0.0.1:3306/bookSystem"; | |
| final String USERNAME="root"; | |
| final String PASSWORD="123"; | |
| /** | |
| * 获取数据库连接对象 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var eventUtil={ | |
| addHandler:function(element,type,handler){ | |
| if(element.addEventListener){ | |
| element.addEventListener(type,handler,false); | |
| }else if(element.attachEvent){ | |
| element.attachEvent("on"+type,handler); | |
| }else{ | |
| element["on"+type]=handler; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 一、三种设置虚拟目录的方式 | |
| Tomcat设置 /conf/server.xml | |
| • 修改端口号 | |
| <Connector port="8080" protocol="HTTP/1.1" | |
| connectionTimeout="20000" | |
| redirectPort="8443" /> |