aspose file tools*
The moose likes Struts and the fly likes ActionForm problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionForm problem" Watch "ActionForm problem" New topic
Author

ActionForm problem

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
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

Joined: Jan 10, 2002
Posts: 61654
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ActionForm problem