wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts validation problem.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts validation problem.." Watch "Struts validation problem.." New topic
Author

Struts validation problem..

Umar Hathab Abdullah
Greenhorn

Joined: Jan 23, 2003
Posts: 18
Hi,
I have a web application deployed on Orion Servert. I am using Struts stuffs.
This is my validation.xml
<form-validation>
<formset>
<form name="employeeForm">
<field
property="name"
depends="required">
<arg0 key="employeeForm.name"/>
</field>
</form>
</formset>
</form-validation>
In the struts-config.xml, I have the following..
<global-forwards>
<forward name="employeeform" path="/employeeForm.jsp"/>
</global-forwards>

<!-- Action Mapping Definitions -->
<action-mappings>
<action path="/insertEmployee"
type="net.reumann.InsertEmployeeAction"
name="employeeForm"
scope="session"
input = "employeeform"
>
<forward
name="success"
path="/confirmation.jsp"/>
<forward
name="failure"
path="/confirmation.jsp"/>

</action>
</action-mappings>

When I submit my JSP, And If I dont enter the name field , Validation fails as expected but my request is not getting forwarded.
I am getting this message from the console.
Deligating Via Forward to 'employeeform'.
I am getting Internal Server error on the page.

When I enter the name field, the flow goes fine.
Please help me on this.
Thanks,
Umar
Rick Hightower
Author
Ranch Hand

Joined: Feb 20, 2002
Posts: 350
By default you have to specify the web resource as the input.
If you want to use forwards for your inputs, you have to setup the controller element as follows:
<controller nocache="true" inputForward="true" maxFileSize="2M" />
(Controller element is after action-mappings element but before the message-resource element).
Basically you have to set the inputForward attribute to true.
If you like this answer, check out the book Professional Struts or Struts Live or my company ArcMind.


Rick Hightower is CTO of Mammatus which focuses on Cloud Computing, EC2, etc. Rick is invovled in Java CDI and Java EE as well. linkedin,twitter,blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts validation problem..