错误提示如下
description The server encountered an internal error () that prevented it from fulfilling this request.exception java.lang.NullPointerException
com.team4.action.MsginfoAction.findAllMsg(MsginfoAction.java:29)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
————————————
struts.xml内容如下
<action name="MsginfoAction" class="com.team4.action.MsginfoAction" method="query">
<result name="success">/ht/chatmanage.jsp</result>
<result name="error">/error.jsp</result>
</action>
<action name="MsginfoAction" class="com.team4.action.MsginfoAction" method="findAllMsg" > 
<result name="success">/ht/chatmanage.jsp</result> 
<result name="error">/error.jsp</result> 
</action>
—————————————————————
MsginfoAction.java内容如下
public class MsginfoAction extends ActionSupport implements ModelDriven<TSysMsg>{
private ServiceMsginfoDao serviceMsginfoDao;
private TSysMsg ServiceMsginfoDao = new TSysMsg();
private Timestamp FMsgTime;

public void setServiceMsginfoDao(ServiceMsginfoDao serviceMsginfoDao) {
this.serviceMsginfoDao = serviceMsginfoDao;
}
public TSysMsg getModel(TSysMsg msginfo) {
// TODO Auto-generated method stub
return msginfo;
} public String findAllMsg(){
List<TSysMsg> list = serviceMsginfoDao.findAllMsg();
ActionContext.getContext().put("list", list);
return "success";
}
——————————————————————————————-————-
jsp内容如下
<head>
<base href="<%=basePath%>">
<title>消息管理 </title>
</head>
<body>
 
<table align="center" style="margin-top:10px;">
<tr height="100px" align="center"><td>
<form action="MsginfoAction_query.action" method="post">
请输入时间:<input type="text" name="FUserid" style="color:#000000"/>
<input type="submit" value="查找" style="color:#000000"/>
</form>
</td></tr>
<tr>
<td>
<a href="<%=basePath%>MsginfoAction_findAllMsg.action">显示所有消息</a>
</td>
</tr>
————————————————————————————
求高手指点~~~~~~~

解决方案 »

  1.   

    你两个ACTION配一样的名字?肯定不行撒
    这样写:
    <action name="queryMsg" class="com.team4.action.MsginfoAction" method="query" >  
    <result name="success">/ht/chatmanage.jsp</result>
    <result name="error">/error.jsp</result> 
    </action>
    <action name="findAllMsg" class="com.team4.action.MsginfoAction" method="findAllMsg" >  
    <result name="success">/ht/chatmanage.jsp</result>  
    <result name="error">/error.jsp</result>  
    </action>
    那页面就作下修改:
    <form action="queryMsg.action" method="post">
    这样应该没问题了,不过其实一般不这样写,可以像下面这样把两个方法集合到一个配置中:
    <action name="*Msg" class="com.team4.action.MsginfoAction" method="{1}" >  
    <result name="success">/ht/chatmanage.jsp</result>  
    <result name="error">/error.jsp</result>  
    </action>
    那么在JSP中还是像我上面那样写,但是你的ACTION中必须要有个方法名字跟Msg前面的*号相同的方法,这样是最简单的
      

  2.   

    的确他的struts.xml重名了,是问题的所在
      

  3.   

    serviceMsginfoDao是通过Spring注入的吗?不是的话那你自己的初始化!!