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

Strtus2遇到的问题

2013年08月09日 ⁄ 综合 ⁄ 共 1461字 ⁄ 字号 评论关闭

1 Unable to load configuration. - bean - :file:/D:/Tomcat6.0/webapps/ss/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:46:178 
答案:http://blog.chinaunix.net/u/22371/showart_1868796.html 
2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatch错误? 
答案:你是把所有的struts2的jar包都添加了吗?我曾把所有的都加进去了,就犯这个错误,因为有的jar需要别的jar的支持。你把不用的jar都删了,如关于spring的,等等,只留一些该留的。jar包要精简。如果要是有javaservlet的错误可以把servlet包加入。把tomcat中的这个包去掉。 
3 警告: Could not find action or result 
There is no Action mapped for namespace / and action name HelloWorld. - [unknown location] 
答案: 
1.   要将struts.xml配置文件放在src下,而不是某个package下或者其它地方,这样才能 
        保证WEB-INF\classes下有编译的类文件和struts.xml的配置文 
2. 在struts.xml中,如果在package中定义了命名空间,如namespace="/com/leo/action",那  么在浏览器中url就必须带package的信息, http://localhost:8080/Struts2Demo/com/leo/action/HelloWorld.action如果没有定义namespace, 则http://localhost:8080/Struts2Demo/com/leo/action/HelloWorld.action
和 http://localhost:8080/Struts2Demo/HelloWorld.action 

都可以的 
3. 注意拼写,比如struts写成structs,stuts;default写错了等等 

4 警告: Could not find action or result 
No result defined for action tutorial.HelloWorld and result success 
答案是:实验把SUCCESS 改为小写或者是去掉。应为她是有默认值的。再就是要看action了。 

5 Expression parameters.formName is undefined on line 101, column 43 in template/simple/doubleselect.ftl. 
The problematic instruction: 
---------- 
==> ${parameters.formName} [on line 101, column 41 in template/simple/doubleselect.ftl] 
in include "/${parameters.templateDir}/simple/doubleselect.ftl" [on line 25, column 1 in template/xhtml/doubleselect.ftl] 
答案:因为表单没有form  没有name属性 

抱歉!评论已关闭.