求教一个关于struts2的问题
使用是tomcat6.0 + struts2.0,struts.xml放在了src目录下
首先贴出错误信息如下:
java.lang.NullPointerException
org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:434)
web.xml配置如下:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>/category/main.jsp</welcome-file>
</welcome-file-list>
<struts>
<include file="struts-authorize.xml"/>
<include file="struts-category.xml"/>
<include file="struts-cart.xml"/>
<include file="struts-order.xml"/>
<package name="dang-default" extends="json-default">
</package>
</struts>
$(function(){
$.get(
"cat.action",
function(data){
$("#left").html(data);
}
);
});
<package namespace="/category" name="category-default" extends="dang-default">
<action name="cat" class="dangdang.actions.category.CategoryAction">
<result name="success">/category/category.jsp</result>
</action>
</package>
/**
*...
*/
public String execute(){
ICategoryDAO dao=new DCategoryDAO();
cats=dao.findByid(1, true);
return "success";
}
/**
*...
*/
<struts>
<include file="struts-authorize.xml"/>
<include file="struts-category.xml"/>
<include file="struts-cart.xml"/>
<include file="struts-order.xml"/>
<package name="dang-default" extends="json-default">
</package>
</struts>
<result type="json"/>