struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carmi_cd <>
Subject [S2] Validation
Date Mon, 18 Feb 2008 05:06:51 GMT

Hi I have an application in Struts 2, my problem is when i try to submit the
form even if there are
values in the form input box it stills give validation message to the user
to enter values for the 
required fields. 

here is my form fields.
<s:textfield name="employeeId" label="Employee ID" labelposition="left"
value="%{edituser.empId}" size="10"/>
<s:textfield name="lastname" label="Lastname" labelposition="left"
value="%{edituser.lastName}" size="30"/>
<s:textfield name="firstname" label="First Name" labelposition="left"
value="%{edituser.firstName}"  size="30"/>
<s:textfield name="middlename" label="Middle Name" labelposition="left"
value="%{edituser.middleName}" size="30"/>
<s:textfield name="position" label="Position" labelposition="left"
value="%{edituser.position}" size="40"/>

here is my UserMgt-save-validation.xml:

<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"

    <field name="employeeId">
        <field-validator type="requiredstring">
            <message>Employee ID is required.</message>
    <field name="lastname">
        <field-validator type="requiredstring">
            <message>Lastname is required.</message>
    <field name="firstname">
        <field-validator type="requiredstring">
            <message>First Name is required.</message>
    <field name="username">        
        <field-validator type="requiredstring">
            <message key="requiredstring"/>
    <field name="password">
        <field-validator type="requiredstring">
            <message key="requiredstring"/>
    <validator type="expression" >
      <message>Password confirmation did not match.</message>

I also implement prepare interceptors in my action class UserMgt.class

here is the prepare code

    public void prepare() throws Exception {
             if (userid != null ){
                UserBean userBean = new UserBean();           
                ModuleBean moduleBean=new ModuleBean();                

please help me. Thanks in advance for your help.

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message