tags:

views:

5

answers:

0

Hi

I am trying to apply ajax DWR to my form feilds in struts2 .. I have made the changes in the application ..

1) Added the library struts2-dwr-plugin-2.1.6.jar in the Lib folder.

2) Added the following Servlet mapping in the web.xml .

<servlet>
                           <servlet-name>dwr</servlet-name>
                           <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
                          <init-param>
                                    <param-name>debug</param-name>
                                     <param-value>true</param-value>
                         </init-param>
             </servlet>
             <servlet-mapping>
                           <servlet-name>dwr</servlet-name>
                           <url-pattern>/dwr/*</url-pattern>
            </servlet-mapping>

3) Added the dwr.xml file .

     <!DOCTYPE dwr PUBLIC 
    "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN" 
    "http://www.getahead.ltd.uk/dwr/dwr10.dtd"&gt;

         <dwr>
             <allow>
               <create creator="new" javascript="validator">
                        <param name="class" value="org.apache.struts2.validators.DWRValidator"/>
               </create>
               <convert converter="bean" match="com.opensymphony.xwork2.ValidationAwareSupport"/>
             </allow>

             <signatures>
              <![CDATA[
                                  import java.util.Map;
                                   import org.apache.struts2.validators.DWRValidator;
                                   DWRValidator.doPost(String, String, Map<String, String>); ]]>
               </signatures>
</dwr>

4) In the jsp page in the Form added onblur="validate(this);" for each field ..

but i am not getting the ajax effect ...

What else more i need to do .............