wood burning stoves 2.0*
The moose likes Struts and the fly likes form bean doesn't come into picture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "form bean doesn Watch "form bean doesn New topic
Author

form bean doesn't come into picture

Balaji Londhe
Ranch Hand

Joined: May 02, 2006
Posts: 100
I'm writing a simple application using struts & trying to deploy it on Tomcat Server.

First page of an application just accepts two values(userName and password) from user & passes onto next page via formbean, which then gets displayed on that page.

But my bean never gets populated i.e. no reset(), validate() and setter method gets invoked. THE request just gets forwarded to next page and no value appears there.

Please find below the struts-config.xml file I'm using:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<form-beans>
<form-bean name="loginForm" type="forms.LoginForm">
</form-bean>
</form-beans>
<!-- Action Mappings -->
<action-mappings>
<action name="loginForm" path="/login" scope="session" type="action.LoginAction">
<forward name="success" path="/login.jsp">
</forward>
</action>
</action-mappings>

<!-- Message Resources -->
<message-resources parameter="resource.ApplicationResources"/>

</struts-config>



I have crosschecked the spelling of class names. My formbean also extends ActionForm.

What can be the possible causes, which prevents the bean to come into picture. Any help would be highly appreciated.


Thanks.


Attitude matters the Altitude.
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
need to see your form, action and jsp that uses this form for presentation.
Please use code tags
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I agree...I cannot see anything wrong in your mappings but seeing at least your jsp would help. I take it that you are showing the initial page directly and not using an action.

- Brent
Balaji Londhe
Ranch Hand

Joined: May 02, 2006
Posts: 100
You are right, Brent. Thanks for your reply.
I'm directly invoking my first JSP without action class.
Below are the Action class, Form bean and jsp I'm using:

Index.jsp(which I'm accessing directly as first page)




-------------------------------------------

LoginForm.java (The form bean)




-------------------------

LoginAction.java



------------------------------------------

Login.jsp (The next page which should display userName entered by user)




Thanks...
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
Would you please create a default value for userName in the form. that way you can see if the form is being forund in the indicated scope or it is being created in the useBean tag.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
It might just be a matter of the case on your method...change setUSerName to setUserName.

- Brent
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
Yes Brent. I think you are correct. Good eyes
Balaji Londhe
Ranch Hand

Joined: May 02, 2006
Posts: 100
You are just perfect, Brent.
That was really a mistake.
Thanks a lot, both of you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: form bean doesn't come into picture
 
Similar Threads
Struts 1.1 using RAD7
Cannot find ActionMappings or ActionFormBeans collection
Cannot find ActionMappings or ActionFormBeans collection
problem dispaly error message in struts
Action class not found exception