thank u ! it worked. I was not having Action class conffigured for signup jsp in struts.xml before and thats the problem.
–
a aNov 16 '12 at 14:57

1

@AleksandrM: I'm pretty sure name is enough for textfield, value is not needed unless you wanna show something different from the straight value out from the getter :)
–
Andrea LigiosNov 16 '12 at 15:02

@AndreaLigios: Yes, you are right. Going to delete this from my answer.
–
Aleksandr MNov 16 '12 at 18:38

You are returning a null formBean object with the getFormBean method,
then the constructor is never called and the attempt to acces the formBean attribute firstName is giving an error (that is not showed because it is wrapped by the Struts2 tag on the JSP.

But if you are on a JSP, an Action (and its execute() method, or another method if specified) was called BEFORE rendering the JSP.

So, regardless if you have ActionOne loading stuff and ActionTwo called after submit, or ActionOne loading stuff and another method of ActionOne called after submit, you can know if you are in a "pre-JSP" state or in a "post-submit" state...

That said, if you are exposing an Object, and you want its value or its attributes to be different from null, you have to instantiate it in one of the way described above.

Obviously, your object should contain getters and setters for its attributes, and they must have been bound to your JSP objects.

well, instantiating formBean on execute method is overiding my form entered values into bean fields !! That is, each time submit button is clicked and control goes to execute method of Action class, and when I do, String firstName = formBean.getFirstName(); its picking default values and not the form entered values. So I should not have business logic inside execute method?
–
a aNov 16 '12 at 12:10

Also I think formBean will get instantiated only after Action class is called. So there is no way it can get values when jsp form is rendered on first time. I mean only after submit button is pressed and control goes to Action class, bean gets instantiated and after returning either success or failure and mapping to this jsp accordingly in struts.xml , does this textfields are getting populated from bean. So my question to populate the jsp form on initial rendering itself. Hope you are clear.
–
a aNov 16 '12 at 12:27

Followed what you said but still not success. Let me paste the entire code including struts.xml in the above under the comments <--Edited--> Please check if I did your way.
–
a aNov 16 '12 at 13:39