Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionForm problem

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My ActionForm does not hold data enetered by user. pls guide me where the error is.

My Struts-Config
<form-bean name="registrationForm" type="org.apache.struts.company.RegistrationForm"/>

<action
path="/TestRegister"
type="org.apache.struts.company.RegistrationAction"
name="registrationForm"
scope="request"
input="/pages/Registration.jsp">
</action>

Action class
RegistrationForm regform =
(org.apache.struts.company.RegistrationForm) form;

String fname = regform.getfirstName();
String lname = regform.getlastName();
request.setAttribute("fname", fname);
return mapping.findForward("registerAction"); calls thankyou.jsp

thankyou.jsp
<%= (String)request.getAttribute("fname")%> .....does not fetch anything.


Pls help
[ January 19, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shah_rah:
Pls help


"Pls" is not a word. Please use real words such as "please" when posting.

Also, please read my response to your other post regarding your display name.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
regform.getfirstName();


Struts expects your ActionForm to have getters and setters that follow the JavaBean naming conventions. This getter does not follow that convention. It should be getFirstName().

If your accessors are named getFirstName and setFirstName, the tag:

will cause struts to populate the ActionForm properly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic