现在的位置: 首页 > 综合 > 正文

用Myeclipse5.5+Tomcat5.5整合Spring2.0+struts1.2时出现的兼容性问题及解决办法

2018年04月15日 ⁄ 综合 ⁄ 共 1107字 ⁄ 字号 评论关闭

用Myeclipse5.5+Tomcat5.5整合Spring2.0+struts1.2时出现的兼容性问题及解决办法

1,对JSTL中EL表达式的解析`

在做第一个STRUTS时`在JSP面里用EL表达式显示提交的结果

[code]<h1>
hello, ${userInfo["username']}!!
</h1>[/code]

本来应该显示

[code]hello,pioneer!![/code]

可输出结果却是

[code]hello, ${userInfo["username']}!![/code]

根本没有解析`

去网上搜了一下`发现在JSP页面的Page里加上一条属性就可以正常解析了``

[code]<%@ page isELIgnored="false" %>[/code]

难道Tomcat默认的不翻译EL?

回想一下`我在myeclipse里建web project时选的JavaEE 5.0``

web.xml里设置的servlet2.5版``会不会是它的事``

[code]<web-app version="2.5"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">[/code]

改回2。4的`

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

就都OK了``去了`isELIgnored属性可以正常解析了``

pioneer 2007-7-10 15:03

2.整合Spring2.0和Struts后Servlet action is not available

在Struts中通过Plugin整合Spring后出现Servlet action is not available错误`

检查各配置文件后没有发现配置问题``

后来发现原来是myeclipse没有为Tomcat的web-inf/lib下添加spring.jar``

手动添加后正常`

抱歉!评论已关闭.