This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Struts Validator Question  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Another question regarding the validator framework.If i am doing server side validation using the validator,is there a way to pass parameters when the same page is re-loaded???

More precisely, i have a form in which the fields are displayed depending on the mode,ie, either ADD or EDIT mode.I use multiple form on my JSP page and set mode by passing as hidden parameter from the prevoius page.It loads fine the first time but when validation is done on submitting the form,it re-loads thesame page if error occurs but the hidden params are null. This causes incorrect fields to be displayed.
Is there a way to re- set ur parameters or a better way of doing it?( i am fairly new to programming)

Thanks
 
pie sneak
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using Struts' html:hidden for the parameter? If so, you should have no problems. This assumes you are not using redirects and your forms' reset() method is not resetting the value.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following site has a good tutorial on Struts:

http://www.coreservlets.com/Apache-Struts-Tutorial/
 
Suzi Cooper
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the moment, i use the validator with javascript for validation.The form bean extends ActionForm(not ValidatorForm)and it works perfectly fine.
The issue is i want to use the validator on server side.IF i extend the form as ValidatorForm it throws the error :
No action instance created for the bean.
Here is the code:
##################
validation.xml
<form name="accountDetailsEditForm">
<field
property="username"
depends="required">
<arg0 key="hr.account_maintenance.username"/>
<var>
<var-name>field</var-name>
<var-value>username</var-value>
</var>
</field>
</form>
###########
struts-config.xml
<action
attribute="accountDetailsEditForm"
input="/pages/hr/accountEdit.jsp"
name="accountDetailsEditForm"
path="/accountDetailsEdit"
scope="request"
parameter="do"
type="com.fbbt.matador.mweb.hr.AccountDetailsEditAction"
validate="true">
<forward name="showAddAccount" path="/pages/hr/accountEdit.jsp" />
#############
Any help is appreciated
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!