Use struts1, And the actionform class is as follows:
Private string menutype; private clientuser user;... corresponding get and set methods...
The action class is as follows:
Public actionforward execute (actionmapping mapping, actionform form, httpservletrequest request, httpservletresponse response) {system. out. println ("========= enter the userinfoaction class =========="); userinfoform = (userinfoform) form ;}
However, when submitting a form, you may encounter the following problems:
========= Enter the userinfoaction class ========== 17:24:46 Org. apache. catalina. core. serious standardwrappervalve invoke: servlet. service () for servlet action threw exception Java. lang. illegalargumentexception: No bean specified at Org. apache. commons. beanutils. propertyutilsbean. getpropertydescriptor (propertyutilsbean. java: 751) at Org. apache. commons. beanutils. beanutilsbean. setproperty (beanutilsbean. java: 937) at Org. apache. commons. beanutils. beanutilsbean. populate (beanutilsbean. java: 811) at Org. apache. commons. beanutils. beanutils. populate (beanutils. java: 298) at Org. apache. struts. util. requestutils. populate (requestutils. java: 493) at Org. apache. struts. action. requestprocessor. processpopulate (requestprocessor. java: 816) at Org. apache. struts. action. requestprocessor. process (requestprocessor. java: 203) at Org. apache. struts. action. actionservlet. process (actionservlet. java: 1196) at Org. apache. struts. action. actionservlet. dopost (actionservlet. java: 432) at javax. servlet. HTTP. httpservlet. service (httpservlet. java: 637) at javax. servlet. HTTP. httpservlet. service (httpservlet. java: 717) at Org. apache. catalina. core. applicationfilterchain. internaldofilter (applicationfilterchain. java: 290) at Org. apache. catalina. core. applicationfilterchain. dofilter (applicationfilterchain. java: 206) at com. udrm. BMS. struts. beans. setcharacterencodingfilter. dofilter (setcharacterencodingfilter. java: 54) at Org. apache. catalina. core. applicationfilterchain. internaldofilter (applicationfilterchain. java: 235) at Org. apache. catalina. core. applicationfilterchain. dofilter (applicationfilterchain. java: 206) at Org. apache. catalina. core. standardwrappervalve. invoke (standardwrappervalve. java: 233) at Org. apache. catalina. core. standardcontextvalve. invoke (standardcontextvalve. java: 191) at Org. apache. catalina. core. standardhostvalve. invoke (standardhostvalve. java: 128) at Org. apache. catalina. valves. errorreportvalve. invoke (errorreportvalve. java: 102) at Org. apache. catalina. core. standardenginevalve. invoke (standardenginevalve. java: 109) at Org. apache. catalina. connector. coyoteadapter. service (coyoteadapter. java: 286) at Org. apache. coyote. http11.http11processor. process (http11processor. java: 845) at Org. apache. coyote. http11.http11protocol $ http11connectionhandler. process (http11protocol. java: 583) at org.apache.tomcat.util.net. jioendpoint $ worker. run (jioendpoint. java: 447) at java. lang. thread. run (unknown source)
If I do not submit a form, there is no error. As long as the form is submitted, there is an error. Obviously, this is the execute method of the action class. debug debugging shows that an error is reported when userinfoform = (userinfoform) form gets the form value. I found some information on the Internet, saying that in actionform, as long as it is the property of a custom object, we need to initialize the new object. That is, change the actionform:
Private string menutype; [color = Red] [B] private clientuser user = new clientuser (); // The value must be "new". [/B] [/color]... corresponding get and set methods...
Solution !!