This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting teh same JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting teh same JSP" Watch "Getting teh same JSP" New topic

Getting teh same JSP

manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
I have simple struts JSP and am using struts validation framework for validating the user input...
ON ce, we enter emplooyee name in the JSP, it will validate the user input
for required, special chars, spaces, .. I am displaying the error messages as pop-ups..
Now my doubt is , after the validation is fine, i shold get the same page, with some data displayed in the same page..
how can I achieve this..
[ October 07, 2003: Message edited by: M K Raman ]

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

If the validation is successful you should then be finding out what the forward is in your <action/> elements in the struts-config.xml file. So you might have something like
<forward name="valid" path="/page.jsp" />
In this example, page.jsp is the same page, so when you come back to this page, you should have some data, a bean, or some request/session/application objects that you can deal with that were not there before.
So somewhere in your JSP page you would perform some logic to determine whether or not you are to display your data.
This is, at least, how I would approach it being somewhat new to STRUTS myself. But if someone has a better approach I would be happy to hear it.

GenRocket - Experts at Building Test Data
manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Thanks a lot. I got ur point and am able to implement the same...
[ October 07, 2003: Message edited by: M K Raman ]
[ October 07, 2003: Message edited by: M K Raman ]
It is sorta covered in the JavaRanch Style Guide.
subject: Getting teh same JSP
Similar Threads
Struts Validation Problem
Change of URL upon validation in jsp
Struts understanding
[struts 1] FormFile field in browser not refilled with file path
pagination problem