• Post Reply Bookmark Topic Watch Topic
  • New Topic

issue with scope of a form bean  RSS feed

Souvvik Basu
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating an online exam application, and I am stuck with a validation issue.

I have a link on a jsp page adminHomePage.jspwhich calls an action that retrieves all Tests and all Users present in the database. The form bean being used is TestsNStudentsInfoForm. On success, the list of tests and students are being displayed on a new jsp testRegistration.jsp in drop-down fields. On this new jsp, I am using Struts validation framework to validate for empty fields. The testRegistration.jsp page uses its own form bean TestRegistrationForm to carry the workflow forward. However, the validation method is giving an error

When I convert the TestsNStudentsInfoForm bean from request to session scope, the error is rectified.

Now, my question is, why does the framework look at the bean whose use is already over, and which is not being used at all for the current workflow? Also, as long as the fields are not empty, and the code to add an ActionMessage to the ActionError object is not being executed, it is working fine. Looks like the framework is searching for the old bean before adding an action error, but not otherwise.

Here are my codes


On clicking the link Allow a Student for a Test the /retrieveTestsNStudents path is followed. the struts-config.jsp for this mapping is

The data is being pulled correctly and displayed correctly on testRegistration.jsp.

On clicking the submit button, the following mapping is invoked

The TestRegistrationForm bean is this

My apologies for the long post, but the issue seems to be tied to 2 actions, so I gave both the flows.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!