GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Struts
Go To First  |  Previous Question  |  Next Question 
 Struts  |  Question 53 of 102    Print  
In struts how can i validate the values filled into the text boxes or else using DynaValidatorForm,without using javascript.
Actually with javascript it is working perfect but not without javascript, and i want without javascript?

  
Total Answers and Comments: 6 Last Update: May 20, 2008     Asked by: Raghvendra Dwivedi 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 20, 2006 03:00:08   #1  
Amzad Basha        

RE: In struts how can i validate the values filled int...
Using the validate() method of the ActionForm class, the values filled in the form will be validated in the case there is no JavaScript for validating the form.
 
Is this answer useful? Yes | No
May 21, 2006 15:03:28   #2  
u.vellaisamy        

RE: In struts how can i validate the values filled int...

validator framework requires two xml files, namely

1.validator-rules.xml

2.validation.xml

validator-rules.xml 

          Files provides the rules for the ready made validation available in the framework.

ex:-

Required Field, Requrlare Expression, Email-id etc...

Validation.xml

<form name="validform">

<field property="name">

<arg0 key="validsform.name"/>

</field>

<var>

<var-name>max length</var-name>


 
Is this answer useful? Yes | No
August 03, 2006 13:57:43   #3  
siva kumar reddy        

RE: In struts how can i validate the values filled int...

hi,

we configure validation="true" in config.xml file.then it takes care of execute the validate() method in formbean class.

cheers

siva


 
Is this answer useful? Yes | No
September 15, 2006 17:27:13   #4  
pardeep dureja        

RE: In struts how can i validate the values filled int...
HiStruts provide both client side and server side validation.for client side use for server side the best approach is to use DynaValidatorForm, specify form name in validation.xml and form property and its type and donot forget to make validate="true" in struts-config.xml at appropriate action.Cheers!Pardeep Dureja
 
Is this answer useful? Yes | No
January 25, 2007 21:40:49   #5  
Padmapriya        

RE: In struts how can i validate the values filled int...
Hi please follow thes steps for server side validation. I believe client-side validation is working fine for you and so telling you changes based on that. Hope you have given approriate entries in validation.xml and struts-config.xml.



1. just remove onsubmit attribute from the below given line in your jsp.



<html:form action="/Test.do" onsubmit="return validateTestForm(this)">



So it will look like



<html:form action="/Test.do" >



2. Add this error tag line before your form tag.

<html:errors />

<html:form action="/Test.do" >



3. Now comment validate method in your
FormBean.java



/***

public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request)

{

return null;

}

***/



4. Now your Form class should extend org.apache.struts.validator.ValidatorForm intead of ActionForm....



public class TestForm extends org.apache.struts.validator.ValidatorForm...



Thats all. It will work fine. All the best.


 
Is this answer useful? Yes | No
May 20, 2008 02:59:31   #6  
Satheeshgeek Member Since: May 2008   Contribution: 6    

RE: In struts how can i validate the values filled into the text boxes or else using DynaValidatorForm,without using javascript.Actually with javascript it is working perfect but not without javascript, and i want without javascript?
Hi guys!

we can validate form feilds in 3 ways.

1) using validator framework

2) using validate() method of formbean class. for this we need to set validate="true" in <action-mapping> tag of struts config.xml

3) otherwise we can validate in action class.. but this is extra round trip.

So in my view, using validator framework or validate() method of formbean class is good way.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape