随笔分类 - Java Web编程
摘要:1、惠生活管理系统 客户端API 2‘提交action之后赋相应值session、request...
阅读全文
摘要:设置时效:1分钟HttpSession session=ServletActionContext.getRequest().getSession(true); session.setAttribute("random", random); session.setMaxIn...
阅读全文
摘要:1在src下面新建file名为log4j.properties内容如下:# Configure logging for testing: optionally with log filelog4j.rootLogger=WARN, stdout# log4j.rootLogger=WARN, std...
阅读全文
摘要:1、使用?通配符public User validate(String userName, String password) { String hql = "from User u where u.userName = ? and u.password = ?"; Use...
阅读全文
摘要:1、现在有优惠券Coupon表,用户User表和一张希望可以保存用户对优惠券是否使用信息的表User.classpackage com.life.hibernate.bean;import java.util.ArrayList;import java.util.List;import javax....
阅读全文
摘要:1、跳到webroot下的某个jsp文件 用户管理2、嵌套struts2标签">添加Done!
阅读全文
摘要:1、使用Apache 的 Commons FileUpload FileUpload下载地址: http://commons.apache.org/fileupload/ 下载:commons-fileupload-1.2.2-bin.zip 得到:commons-fileupload-1....
阅读全文
摘要:1、通过request.setAttribute传参HttpServletRequest request=ServletActionContext.getRequest(); ........request.setAttribute("list", list);#request.list ...
阅读全文
摘要:bject转换成int型int xuefen=(Integer)request.getAttribute("xuefen");Done
阅读全文
摘要:对于jsp页面错误处理这里大致有两种方式:一、在Web.xml中配置全局的错误异常处理即凡是该项目下(即虚拟路径下的所有文件)的任意一个文件错误或者异常,都会跳到指定的错误处理页面。全局的错误处理可以处理两种类型的错误:一种是HTTP代码的错误,如404,500,还有一种是异常的错误,如:NullP...
阅读全文
摘要:1、如果html的代码加到jsp,而且引用的css。js文件,容易出现问题,要有正确的路径 ">Done!
阅读全文
摘要:1、不要在链接中接中文参数,而是通过键值对的方式传递Done!
阅读全文
摘要:1function Check()// 验证表单数据有效性的函数{ var name= ''; if(name==""){ window.alert('请先登录!'); return false; } return...
阅读全文
摘要:jsp在服务器上首先会被编译成.java文件并会编译成.class文件。你看看这些java文件就会发现这些东西其实都是java中httpservelet接口的实现类。url指向某一个jsp页面的时候服务端就会调用这个jsp变成的.class文件(这些.class文件最终)。jsp看起来是前台的展示代...
阅读全文
摘要:1 专业名称 排名 大学名称 ${major.rank } ${major.collegename } Done
阅读全文
摘要:1、onload属性跳转到servlet,地址是:http://lenovo:8080/wx_kaoyan/servlet/MainAction 2、jsp:forward跳转到servlet,地址是:http://lenovo:8080/wx_kaoyanDone!
阅读全文
摘要:1/*** Struts2判断GET/POST请求*/String method = ServletActionContext.getRequest().getMethod();System.out.println(method);if (method.equals("POST")) {// 注意全部大写System.out.println("POST请求");} else {System.out.println("GET请求");}2、当服务器上跑一个工程时,访问index.jsp的方法是get方法Done
阅读全文
摘要:1、Add Spring Capabilities2、Add struts2 Capabilities+对应版本的struts2-spring-plugin-2.2.1.jar,最好是对应版本3、web.xml struts org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts /* 3、struts.xml(1) 配置为Spring (2) 配置...
阅读全文
摘要:1、在Spring里,Hibernate的资源要交给Spring来管理。Hibernate及其SessionFactory等只是Spring一个特殊的Bean,由Spring负责实例化与销毁。由于Hibernate全部交给Spring来管理,HIbernate不再需要自己的配置文件,所有的参数都在S...
阅读全文
摘要:1、在新建的web工程右键“MyEclipse”--“Add Hibernate Capabilitis”2、配置文件:hibernate.cfg.xml org.hibernate.dialect.MySQLDialect jdbc:mysql://localhost:3306/hibernate?characterEncoding=UTF-8 root fclbri com.mysql.jdbc.Driver none create ...
阅读全文

浙公网安备 33010602011771号