Results 1 to 2 of 2
  1. #1
    tanalyw is offline Member
    Join Date
    Apr 2008
    Posts
    4
    Rep Power
    0

    Default 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?

  2. #2
    tanalyw is offline Member
    Join Date
    Apr 2008
    Posts
    4
    Rep Power
    0

    Default

    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

  1. Database JPA,JTA,Validator,etc. on JavaSE
    By jicxicmic in forum New To Java
    Replies: 0
    Last Post: 08-31-2009, 04:49 PM
  2. How to make a hashmap to allow duplicate values?
    By Preethi in forum New To Java
    Replies: 0
    Last Post: 02-08-2008, 01:35 PM
  3. How to prevent duplicate username entry in database?
    By anki1234 in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 01-09-2008, 09:02 AM
  4. Replies: 1
    Last Post: 07-06-2007, 05:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •