今天遇到一个相当郁闷的问题,今天上午在struts.xml中配置action,访问的时候总是提示找不到,而昨天在struts.xml中配置的action却可以找到,搞得头疼,请大家帮忙解答一下Struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.i18n.encoding" value="utf-8"></constant>
<constant name="struts.custom.i18n.resources" value="message"></constant>
<package name="struts2" extends="struts-default">
<!--下面的是昨天配置的action-->
<action name="productType" class="com.cn.web.action.product.ProductTypeAction">
<result name="success" >/default.jsp</result>
</action>
<!--下面的是今天配置的action-->
<action name="productTest" class="com.cn.web.action.product.ProductTestAction">
<result name="success" >/default.jsp</result>
</action>
jsp页面中使用<s:url action="productType"/>可以访问到,而使用<s:url action="productTest"/>却访问不到没有找到该action
另外今天上午重装了一下eclipse,是不是这个引起的问题
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.i18n.encoding" value="utf-8"></constant>
<constant name="struts.custom.i18n.resources" value="message"></constant>
<package name="struts2" extends="struts-default">
<!--下面的是昨天配置的action-->
<action name="productType" class="com.cn.web.action.product.ProductTypeAction">
<result name="success" >/default.jsp</result>
</action>
<!--下面的是今天配置的action-->
<action name="productTest" class="com.cn.web.action.product.ProductTestAction">
<result name="success" >/default.jsp</result>
</action>
jsp页面中使用<s:url action="productType"/>可以访问到,而使用<s:url action="productTest"/>却访问不到没有找到该action
另外今天上午重装了一下eclipse,是不是这个引起的问题
如果出现eclipse不能自动编译的问题,可以尝试以下的解决方法: 1.选中project->build automatically。
2.选择project->clean..->clean select project,这样就会把原来已经生成的class文件全部删除掉,eclipse会重新生成所有的类文件。
3.在WEB工程中,进入configure build path,在java build path->source下的output folder修改为
<工程名>/WebRoot/WEB-INF/classes 4.另外一个最重要的问题是,如果项目中引用了一些lib包,现在却找不到那些lib包了,不管那些 lib包在项目中还用不用了,都会因为它们的不存在而使eclipse不能自动编译。造成这种情况的原因可能是转移了lib包的路径,或者原来的项目是在其他的机器上,lib包也在原来的机器上,就会出现lib包找不到的情况。解决方案是, 进入configure build path中,将所有可疑的lib包remove掉。
我也有遇到过eclipse不自动编译的问题,这就需要手动设置一下了