| Author |
why is my loginForm stopped processing the user input
|
kay lin
Ranch Hand
Joined: May 20, 2004
Posts: 132
|
|
hi all: I have written a login page using Struts, basically the loginForm takes the user input at the JSP page and process it here is a snippet of my JSP code and here is the code for my LoginForm class and in my LoginAction class,it tries to get the userId from the form first and then process it... But when i run this, every time, the print out of user id is "NULL" even if i entered a user id in the form, it works okay if i use request.getParameter("userID") though can somebody please tell me what is going on? Many Thanks
|
 |
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
|
|
Hi The way u r instantiating the form bean is wrong ....saying new LoginForm() will create a new instance which will give u always null. If u look at the parameters in the execute/perform method the form will give the instance which is populated by struts .so in ur actio u need to just typecast the object by saying LoginForm loginForm=(LoginForm)form; Internally whenever a req is fired the insatnce will be populated and that will be populated in the request in the form of req.setAttribute("LoginForm") this is the name waht u have given in ur struts-config and finally this is what u get as parameter ..............-
|
 |
kay lin
Ranch Hand
Joined: May 20, 2004
Posts: 132
|
|
|
THanks
|
 |
 |
|
|
subject: why is my loginForm stopped processing the user input
|
|
|