1. struts.xml core code
<action name="login" class="org.gl.app.action.LoginAction" ><result name="success">/WEB-INF/content/welcome.jsp</result>
</action>
<action name="*">
<result>/WEB-INF/content/{0}.jsp</result>
</action>
2. loginForm.jsp core code
<body>
<s:form action="login">
<s:textfield name="username" key="user"/>
<s:textfield name="password" key="pass"/>
<s:submit key="login"/>
</s:form>
</body>
private String username;
private String password;
set and get methods
4. welcome.jsp key code<s:actionmessage/>
Run and see a prompt in the background:
23:11:16.669 [http-nio-8080-exec-4] ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor - Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'login' on 'class org.gl.app.action.LoginAction: Error setting expression 'login' with value ['login', ]
The same prompt also appeared in my welcome, as follows:
--------------------------------------------------------------------------------
At this time, as long as I add the login private variable and the set and get methods to the action, or assign the key after s:submit in Chinese, such a prompt will not be reported.
, this is caused by <s:submit key="login"/> in loginForm.jsp, I wonder how s:submit is submitted as form data like s:textfield, and I am drunk. . .