• 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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
Sheriff
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: 10447
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!