This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Validation based on Database results 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 "Validation based on Database results" Watch "Validation based on Database results" New topic
Author

Validation based on Database results

Shailesh Pillai
Ranch Hand

Joined: Jan 24, 2006
Posts: 78
Hi all,
I am using Struts Framework. I have 2 JSPs "Page1.jsp" & "Page2.jsp".
On submitting Page1.jsp, i am getting the data from the database into <html:text> controls in Page2.jsp.

For instance,
I have 2 fields NAME & ADDRESS in Page2.jsp. Value for NAME is obtained from database & ADDRESS is empty.
I would like to perform the following:
If NAME is not null then NAME should be disabled & ADDRESS should get the focus.
If NAME is null then NAME should be enabled.

How can i do this ???
I am using Struts Validator for validations.
Thnks in advance....
[ April 18, 2006: Message edited by: Shailesh Pillai ]
Satish SN
Ranch Hand

Joined: Apr 19, 2005
Posts: 70
Hi shailesh,

u can use sturts logic tags to solve ur problem

ie u check for null using either notEmpty or equals or notEquals and accordingly u write the html:text entries with property "disabled" set to true so that the textfield will be disabled

hope my clue works out for u


Satish SN<br />SCJP 1.4 & SCWCD 1.4
Shailesh Pillai
Ranch Hand

Joined: Jan 24, 2006
Posts: 78
Thanks satish for ur suggestion. Let me check it out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation based on Database results
 
Similar Threads
jsp page redirection
pre-selecting values in a select list
two actionForms for one action class?
Navigating to another page...
forward action