Results 1 to 2 of 2
- 03-08-2010, 01:29 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 4
- Rep Power
- 0
Custom Validator for checking duplicate values with database
Hi,
I am rather new to the struts validation framework. I am using struts 1.3.5.
I need to provide client side validation using the framework. I would like a popup to appear if the input entered by user is a duplicate of what is in the database.
public class customValidator {
//method to check duplicate
public boolean checkDuplicate(....) {
//get values from database, match and return false if matched
}
How to I enable a popup to appear?
- 03-08-2010, 01:34 PM #2
Member
- Join Date
- Apr 2008
- Posts
- 4
- Rep Power
- 0
validation.xml I have the following lines.
<formset>
<form name="testForm">
<field property="typeName"
depends="required,checkDuplicate">
<arg0 key="testForm.typeName"/>
</field>
</form>
</formset>
validator-rules.xml I have the following.
<validator name="checkDuplicate"
classname="test.customValidator"
method="checkDuplicate"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
msg="errors.checkDuplicate"/>
Do i need to input the javascript? If yes, how?
Similar Threads
-
Database JPA,JTA,Validator,etc. on JavaSE
By jicxicmic in forum New To JavaReplies: 0Last Post: 08-31-2009, 03:49 PM -
How to make a hashmap to allow duplicate values?
By Preethi in forum New To JavaReplies: 0Last Post: 02-08-2008, 12:35 PM -
How to prevent duplicate username entry in database?
By anki1234 in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 01-09-2008, 08:02 AM -
Struts Validator - JScript version of Validator ´validwhen´
By Felissa in forum Web FrameworksReplies: 1Last Post: 07-06-2007, 04:39 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks