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
| //注意要点 | |
| //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
| //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
| 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
| jar | |
| commons-codec-1.6.jar | |
| sha.js | |
| <form action="login" method="post" class="formgo"> | |
| <c:choose> | |
| <c:when test="${param.error=='1001' }"> | |
| <p>用户名或密码错误 </p> | |
| </c:when> |
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
| login.java: | |
| if(rm != null){ | |
| Cookie usernameCookie =new Cookie("username", username); | |
| usernameCookie.setDomain("www.wdfx100.com"); | |
| usernameCookie.setPath("/"); | |
| usernameCookie.setMaxAge(60*60*24); | |
| Cookie passwordCookie =new Cookie("password", password); | |
| passwordCookie.setDomain("www.wdfx100.com"); | |
| passwordCookie.setPath("/"); |
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
| //让session过期 | |
| request.getSession().invalidate();//安全退出,强制Session过期 | |
| //删除cookie | |
| Cookie[] cookies = request.getCookies(); | |
| if(cookies!=null){ | |
| for(Cookie c:cookies){ | |
| if("username".equals(c.getName())||"password".equals(c.getName())){ | |
| c.setMaxAge(0); | |
| c.setPath("/"); | |
| c.setDomain("www.wdfx100.com"); |
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
| function createXMLHttpRequest(){ | |
| var xmlHttp;//创建ajax引擎 | |
| if(window.ActiveXObject){ | |
| xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
| }else{ | |
| xmlHttp = new XMLHttpRequest(); | |
| } | |
| return xmlHttp; | |
| } |
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
| HttpClient client = null; | |
| try { | |
| client = new DefaultHttpClient();//获得一个代理 | |
| HttpGet get = new HttpGet("http://www.youdao.com/smartresult-xml/search.s?type=id&q="+code);//获得请求 | |
| HttpResponse response = client.execute(get);//获得响应 | |
| InputStream stream = response.getEntity().getContent(); //从内存角度,获得一个输入流 | |
| BufferedReader reader = new BufferedReader(new InputStreamReader(stream,"GBK")); | |
| //获得的文字,以字符流的形式输出【图片、MP3,文件用字节流输出】 | |
| StringBuilder sb = new StringBuilder(); |
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
| /index.html = anon | |
| /user/create = anon | |
| /user/** = authc | |
| /admin/** = authc, roles[administrator] | |
| /rest/** = authc, rest | |
| /remoting/rpc/** = authc, perms["remote:invoke"] | |
| 过滤器名称 过滤器类 描述 | |
| anon org.apache.shiro.web.filter.authc.AnonymousFilter 匿名过滤器 |