Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

struts validation

Posted on 2004-09-15
7
Medium Priority
?
239 Views
Last Modified: 2013-11-24
I have a struts-JSP (say main.jsp) with a FORM which includes another JSP (page1.jsp) with a FORM.

I validate the page1.jsp FORM through struts-validation.xml

The problem is if i get any validation errors, i am getting only the page1.jsp with errors. I want to show the main.jsp even if there are any validation errors in page1.jsp.

As expected, if there are no errors, main.jsp is displyed.

i know how to do validation in my Form-Action but i want to use struts-validator. Can i do something with ValidatorActionForm in my Action class. If so, could you please tell me how?

Any suggestions?
0
Comment
Question by:ldbkutty
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 750 total points
ID: 12062827
I think you will have to do your validation by code in the Action, then return the mapping to the main page no matter what...

Struts returns you to the page that caused the errors if they are detected by validation.xml (as you have seen)
0
 
LVL 32

Author Comment

by:ldbkutty
ID: 12062832
Just edited my Question Tim ;-)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12062863
Whoops ;-)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 14

Expert Comment

by:boonleng
ID: 12064735
This attribute 'input' is the page to return when error detected by struts validator.
Example:
<action path="/main"
      type="SomeAction"
      name="someForm"
      validate="true"
      input="/main.jsp"
      scope="request">

What do you mean by "Can i do something with ValidatorActionForm in my Action class. If so, could you please tell me how?"?
0
 
LVL 32

Author Comment

by:ldbkutty
ID: 12064846
I mean we use 'ValidatorForm' in form-bean to override the the existing validate() method of form-beans with struts validator.

I dont know about 'ValidatorActionForm' ... Is it the similar to 'ValidatorForm', but for form-action class?
0
 
LVL 14

Assisted Solution

by:boonleng
boonleng earned 750 total points
ID: 12064999
0
 
LVL 32

Author Comment

by:ldbkutty
ID: 12078539
i think its not possible for my case. i went with validation in my action class. thanks for your time, though.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question