Solved

struts validation

Posted on 2004-09-15
7
223 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 250 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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 250 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groovy example issue 10 90
Java. Convert method from recursion based to iteration based ( loop based ) 6 76
Java DateChooser? 3 29
javap not working 8 37
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now