Solved

struts validation

Posted on 2004-09-15
7
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

627 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