Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • 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

struts2 hidden fields empty after validation

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have some hidden fields in in my form after server side struts validation these fields are emptied. what is the possible workaround to handle this problem.

Thanks in advance
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

First understand when you validate your form and validation called then the flow of your project not reached at your action calss.

So all the variable which is use in jsp initialize again when your validation fail.

so, when you validate every time your validate methid call.

so Override validate methd in your Action class and initialize your hidden varibale in validate methid. Like.

@Override
public void validate() {
hiddenvaribale=value;
}

all variable which you want to get back when validation failed you have to again initialize at validate method.


If you have still any problem post your jsp code and action code.




 
kuha guna
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nishan.
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

Your welcome.

But is it working fine ??


 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic