aspose file tools
The moose likes Struts and the fly likes ActionForm problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply 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: 56191
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ActionForm problem
 
Similar Threads
problem in logic:iterate
switching to HTTPS
Getting problem in struts
Using bean:define
ActionForm returning null in ActionClass