Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re-populate form after DynaValidatorForm Fails

 
Erap Estrada
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since using DynaValidatorForm will exclude creating a class form, how can i repopulate my form once it fails.

If there are multiple ways to do it, what's the best practice.

I prefer using EL and JSTL.

Thanks in advance.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best practice in a Struts application is to use the struts html tags (html:form, html:text, etc). If you use these tags, Struts will automatically repopulate the values when a validation error causes the page to be redisplayed.
 
Erap Estrada
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill.

Ive read in the book "Struts Design and Programming by Budi Kurniawan" that JSTL is more powerful than struts on tag libraries, so im just getting the suggestions.

Ive seen your posts on these forum and i believe you got pretty good experience with Struts.

Do you know any website or URL that can give me some best practices? Or maybe you can give me some quick points.

Thanks in advance!
 
Erap Estrada
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Follow up question:

Is it ok to use both JSTL and Struts taglib in the same application?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Erap Estrada:
Is it ok to use both JSTL and Struts taglib in the same application?


Yes, absolutely. Whenever both tag libraries perform the same function, I prefer to use JSTL. However, JSTL has no equivalent to the html:xxx tags. These were made specifically to interact with a Struts ActionForm bean, and there is nothing in JSTL that will do this.

As far as best practices go, just do some research on the web and you'll find plenty of good articles. Here are a few of my favorites:

http://www.javaworld.com/javaworld/jw-09-2004/jw-0913-struts.html
http://husted.com/struts/tips/index.html
http://wiki.apache.org/struts/
 
Erap Estrada
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks merrill.

I have another question but ill create another thread. Hope you can help me there.

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic