• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

form bean doesn't come into picture

 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
need to see your form, action and jsp that uses this form for presentation.
Please use code tags
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It might just be a matter of the case on your method...change setUSerName to setUserName.

- Brent
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Brent. I think you are correct. Good eyes
 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are just perfect, Brent.
That was really a mistake.
Thanks a lot, both of you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic