permaculture playing cards
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

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=""/>


Action class
RegistrationForm regform =
( form;

String fname = regform.getfirstName();
String lname = regform.getlastName();
request.setAttribute("fname", fname);
return mapping.findForward("registerAction"); calls 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

Joined: Jan 10, 2002
Posts: 63844

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] [About Bear] [Books by Bear]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864

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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: ActionForm problem
It's not a secret anymore!