wood burning stoves 2.0*
The moose likes Struts and the fly likes How to validate content in dynamically generated textfields? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to validate content in dynamically generated textfields?" Watch "How to validate content in dynamically generated textfields?" New topic
Author

How to validate content in dynamically generated textfields?

abi chitnis
Greenhorn

Joined: Feb 13, 2009
Posts: 11
I am dynamically genearting textfields on jsp. How do I validate content of those textfields in acton bean? Following is my jsp.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Depends on what kind of validation you need to do.

For "requiredstring" type validation just iterate over the map entries and make sure there's a value.
abi chitnis
Greenhorn

Joined: Feb 13, 2009
Posts: 11
Initially I juat want a simple validation. So when user clicks on serach button with out entering anything on the page then I will go back to same page with message displayed at the top. But some how it is not working for me. Following is the flow.
display.action - display.jsp (displays dynamic text boxes and dropdowns)

when user clicks on serach button - showquery.action





David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

"But some how it is not working for me" is not a helpful diagnostic.

http://faq.javaranch.com/java/TellTheDetails

You may want to reduce the amount of code you post, showing only the necessary details. You have a *lot* of code in your action methods and it's difficult to know what to look at.
abi chitnis
Greenhorn

Joined: Feb 13, 2009
Posts: 11
I was trying to presrve actionErrors and actionMessages across resulttype redirect. I was able to fix that using MessageStoreInterceptor.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to validate content in dynamically generated textfields?
 
Similar Threads
Dynamic radio button problem
s:iterator, can you save values other control tags like s:label? POJO
How to access selected values of dynamically generated multi select list on jsp from action method?
form visibility
s:iterator question