Solved

struts validation

Posted on 2004-09-15
7
222 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
Comment Utility
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
Comment Utility
Just edited my Question Tim ;-)
0
 
LVL 35

Expert Comment

by:TimYates
Comment Utility
Whoops ;-)
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 14

Expert Comment

by:boonleng
Comment Utility
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
Comment Utility
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
Comment Utility
0
 
LVL 32

Author Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

762 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

11 Experts available now in Live!

Get 1:1 Help Now