Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

issue with scope of a form bean

 
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

adminHomePage.jsp


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.
testRegistartion.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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic