日期:2014-05-17  浏览次数:20615 次

訪問struts時的路徑問題
struts.xml
<constant name="struts.i18n.encoding" value="utf-8"/>
  <package name="struts" extends="struts-default">
  <action name="*_*" class="{1}Action" method="{2}">
 
  </action>
 </package>

applicationContext.xml
  <bean id="goodsDAO" class="com.qcs.dao.GoodsDAO">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="goodsBIZ" class="com.qcs.biz.GoodsBIZ">
<property name="goodsDAO" ref="goodsDAO"></property>
</bean>
<bean id="goodsAction" class="com.qcs.action.GoodsAction">
<property name="goodsBIZ" ref="goodsBIZ"></property>
</bean>


訪問路徑
http://127.0.0.1:8888/shopping/goods_selectGoods


報錯
Unable to instantiate Action, goodsAction, defined for 'goods_selectGoods' in namespace '/'goodsAction
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:307)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

說沒有找到 goodsaction

why?


------解决方案--------------------
http://127.0.0.1:8888/shopping/goods_selectGoods.Action