• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts validation problem..

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Author
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
money grubbing section goes here:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic