web项目问题记录

1.出现java.lang.IllegalStateException异常,this web application instance has been stopped already.  Could not load java.net.BindException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.在重新部署是发生,由于之前的线程未结束引起的,不影响功能。解决办法:修改tomcat目录下conf文件夹下的server.xml, 在<Host>标签添加子元素找到<Context>标签,把reloadble的属性值设为:reloadable="false"。

2.ajax,如果open选用get方式提交则send参数为null。如果open选用post提交则 xmlHttpRequest.open("POST","login.jsp",true);
                   xmlHttpRequest.setRequestHeder("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
                   xmlHttpRequest.send("user="+username+"&pwd="+password);

3.xmlHttp.open("GET","time.asp",true);第三个参数表示为异步处理

4.设置struts2的中文乱码解决filter

5.request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");容易忘记

6.ognl不一定要在struts2标签库里使用,使用和jsp一样的

7.struts拦截了request.getAttribute()方法并重新实现了它,如果HttpServletRequest没有我们要的属性,就从actionContext中找我们Put的对象 ,再没有就找valuestack中找,所有你后面把自定义 的test放到值栈中去了,就把本身action中的test属性盖了,el就只能找到这个hello了。 

8.在jsp页面使用ActionContext,<%@ page import="com.opensymphony.xwork2.util.*"%>

ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");
List<BigSort> l = (List)vs.findValue("bigSort");

9.ActionContext.getContext().getValueStack().set("bigSort", l);值放入ValueStack

10.hql分页查询Query query = session.createQuery("from Goods");
query.setFirstResult(num);
query.setMaxResults(count);
List<User> list = query.list();

11.外键查询时:Query query = session.createQuery("select count(*) from Goods where smallSort=?");
query.setParameter(0, smallSort);

long count = (Long) query.iterate().next();

12.在本地html页面与服务器进行ajax交互时会出现问题,只要把本地html页面通过服务器访问便可,jquery文件放在webroot目录下即可

13.为了在jsp中使用ognl可以借助struts2标签库<s:property value="list"/>

14.inverse为true的一方放弃管理关联关系

15.Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory

数据连接池是在启动web服务器的时候才完成初始化的。
当然连接不到数据库,spring中肯定有很多dao的操作,
这些dao也都没有得到数据连接。
16.hql语句from User where userName=?
17.一个找了很久的错误:struts.xml文件中,导入别的struts-user.xml文件时注意里面的常量设置。
18.有时候明明什么都是对的,但是值就是为空,很有可能就是漏了get,set方法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值