Hi, friends

I am new to struts 2.1.6 I know complete struts 1.2 but just started 2.1.6.

I am developing one sample structure of add, update, delete, view and list to 
understand struts 2.1.6.

Now I am writing my problem.

>From index page one link "go" to redirect me to "show" page. This page 
>contains all fields to fill (s:textfield, s:file, s:select .... all) then one 
>button named "ADD" which will forward me to the view page with content.

But inbetween this I have been put up validation of 3 fields "firstname", 
"middlename", "lastname" which are required.(not others to get less confused)

during validation it creates two problems.

1. I fill one field firstname not other two. Here validation works and it 
verifies "input" parameter and come back to show page. but it show error for 
required in all the three fields. ??(required error only for two field not for 
firstname. isn't it?)

2. If I fill all the field (all three) then it must be redirect to next success 
page which i set list page. but it want it come back to the same page without 
setting all field (means it is just like one new page to fill).

I am using xhtml theme.

I am displaying below my struts.xml and validation xml file.

------------------
struts.xml
------------------

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
      "http://struts.apache.org/dtds/struts-2.0.dtd";>

<struts>
    <package name="com.employee.action" extends="struts-default">

        <interceptors>
            <interceptor-stack name="basicstack1">
                <interceptor-ref name="validation">
                    <param 
name="excludeMethods">showEmployee,listEmployee</param>
                </interceptor-ref>
                <interceptor-ref name="exception"/>
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="params"></interceptor-ref>
                <interceptor-ref name="workflow">
                    <param 
name="excludeMethods">showEmployee,listEmployee</param>
                </interceptor-ref>

            </interceptor-stack>
        </interceptors>


      <action name="*EmployeeTheme"
              class="com.royal.employee.action.Employee"
              method="{1}Employee">
              <interceptor-ref name="basicstack1"></interceptor-ref>

           <result name="input">/jsp/employee/showEmployeeTheme.jsp</result>
               <result 
name="success">/jsp/employee/{1}EmployeeTheme.jsp</result>
         <result name="list">/jsp/employee/listEmployeeTheme.jsp</result>

      </action>

    </package>


</struts>



------------------------
Employee-validation.xml
------------------------

<!DOCTYPE validators PUBLIC
        "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
        "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>

<validators>
        <field name="firstName">
                <field-validator type="required">
                        <message>First Name is required</message>
                </field-validator>
        </field>
        <field name="middleName">
                <field-validator type="required">
                        <message>Middle Name is required</message>
                </field-validator>
        </field>
        <field name="lastName">
                <field-validator type="required">
                        <message>Last Name is required</message>
                </field-validator>
        </field>
</validators>


------------------------------------------


Please reply....
I am trying to solve this problem from continues two days...

thanx in advance...


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to