struts1 hibernate el validation 注册登录

来源:互联网 发布:淘宝店铺复制软件 编辑:程序博客网 时间:2024/06/06 16:43

1、QuerySyntaxException: unexpected token       ——hql语句中where错拼成whrer

2、The path of an ForwardConfig cannot be null          ——使用了validation的话,struts-config.xml里配置action必须加上input=某页面 ,因为validation验证通不过时会自动跳转到某页面。


3、mapping.findForward(" ")    ——引号里面不能直接写网页地址,必须是struts-config.xml里配置的forward name


4、warning:Positional parameter are considered deprecated; use named parameters or JPA-style positional parame                    —— hibernate 警告应该使用符合新规范的占位符,如:

String hql = "FROM Users WHERE userName = ?0 AND userPassword = ?1";Query query = session.createQuery(hql).setParameter("0", "userName").setParameter("1","userPassword");

String hql = "FROM Users WHERE userName = :userName AND userPassword = :userPassword";Query query = session.createQuery(hql).setParameter("userName", "userName").setParameter("userPassword","userPassword");

5、${ }  EL表达式不生效,在jsp页面加上  <%@ page isELIgnored="false" %>  ,或者去掉web.xml里的<!DOCTYPE >元素,将根元素<web-app>的属性设置为

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >


 原因: servlets 2.3(对应jsp 1.2)或更早版本默认忽略el表达式,之后的版本才默认识别el表达式。

0 0
原创粉丝点击