新手求助高手,message实例出错.

06-08-15 xnhncu2000

StandardWrapperValve[action]: Servlet.service() for servlet action threw exception

javax.servlet.ServletException: System error! please call system Admin.java.lang.Exception: Need a field : 〈html:hidden property=action /〉 in jsp's form!

javax.servlet.ServletException: System error! please call system Admin.java.lang.Exception: Need a field : 〈html:hidden property=action /〉 in jsp's form!

at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)

at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)

at java.lang.Thread.run(Thread.java:534)

message.jsp部分代码如下:

<html:form action="/messageSaveAction.do" method="POST" onsubmit="return checkPost();">
<html:hidden property="action"/>

MessageId:<html:text property="messageId"/>
<br>
Name:<html:text property="name"/>
<br>
<html:submit property="submit" value="Submit"/>
</html:form>
<p>

哪位高手帮我看看呀。。不甚感激

banq
2006-08-15 18:27

虽然你配了html:hidden property=action /〉

但是它还是报错,是不是你的struts-config为这个action配置的不是你的message.jsp 

粗心错误可能

xnhncu2000
2006-08-16 11:55

下面是struts-config.xml的部分配置:

<action-mappings>
    <action name="userActionForm" path="/userAction" type="com.jdon.strutsutil.ModelViewAction" scope="request" validate="false">
      <forward name="create" path="/user.jsp" />
      <forward name="edit" path="/user.jsp" />
    </action>
    <action name="userActionForm" path="/userSaveAction" type="com.jdon.strutsutil.ModelSaveAction" scope="request" validate="true" input="/user.jsp">
      <forward name="success" path="/result.jsp" />
      <forward name="failure" path="/result.jsp" />
    </action>
  </action-mappings>

这个不是第一个的.但都差不多.

我输入http://localhost:8080/web/userAction.shtml不会提示开始那样的错误,但如果输入http://localhost:8080/web/user.jsp就会出现错误.

banq老大,这个是什么原因呢??

banq
2006-08-17 18:08

晕:谁让你直接调用user.jsp?

在MVC模式中,user.jsp属于V,V是view视图意思,视图是没有行为能力的,必须被action推出。

所以在MVC中,你不能直接调用jsp了,尤其jsp页面中有一些初始化工作。

xnhncu2000
2006-08-18 17:39

我知道了...多谢banq老大的指点