struts validation

Posted on 2004-09-15
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?
Question by:ldbkutty
  • 3
  • 2
  • 2
LVL 35

Accepted Solution

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)
LVL 32

Author Comment

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

Expert Comment

ID: 12062863
Whoops ;-)
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

LVL 14

Expert Comment

ID: 12064735
This attribute 'input' is the page to return when error detected by struts validator.
<action path="/main"

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

Author Comment

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?
LVL 14

Assisted Solution

boonleng earned 250 total points
ID: 12064999
LVL 32

Author Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
fibonacci ten numbers 4 46
How to convert String matching to regex in java 4 52
servlet filter example 37 72
ejb example issues 3 28
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

820 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