struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bjorkman <pe...@josh.se>
Subject Struts 2.0.11.2 + Ajax validation using DWR...
Date Thu, 11 Sep 2008 15:53:27 GMT

Hi! Been searching for answers, and although I see lots of similar questions,
none of them has helped me.

Running Struts 2.0.11.2 and DWR 2 I'm not able to get AJAX validation
working. DWR is correctly setup (I've tried exposing beans and the
communication works fine).

My action looks like this (excerpt):
@Validation
public class RegisterEmailAction extends ActionSupport implements
SessionAware {
...
   @RequiredFieldValidator(key = "registration.error.email.missing", message
= "")
    public String getEmail() 
    {
        return email;
    }
...

Client/Server side validation works fine.

In web.xml:
	<servlet>
		<servlet-name>dwr-invoker</servlet-name>
		<servlet-class>
			org.directwebremoting.servlet.DwrServlet
		</servlet-class>
		<init-param>
			<param-name>debug</param-name>
			<param-value>true</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>dwr-invoker</servlet-name>
		<url-pattern>/dwr/*</url-pattern>
	</servlet-mapping>

In dwr.xml:
<!DOCTYPE dwr PUBLIC
    "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
    "http://getahead.org/dwr/dwr20.dtd">

<dwr>
	<allow>
		<create creator="new" javascript="validator">
			
		</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>

My form:
	<s:form action="RegisterEmail!register" method="post" validate="true"
theme="ajax">
	  <s:textfield label="%{getText('registration.email')}" name="email" />
	  <s:submit value="%{getText('registration.next')}" accesskey="S"/>
	</s:form>

Also of course I have <s:head theme="ajax" debug="false" /> in my header.

All that happens when I leave the input field is that onBlur kicks in and
calls validate(this), and an alert saying "null" is displayed. I see no
trace of my action being called at all, debugging logs/breakpoints are not
activated at all.

Nothing in the logs. Anyone have an idea? Should I just give it up?

Regards
Peter Björkman
-- 
View this message in context: http://www.nabble.com/Struts-2.0.11.2-%2B-Ajax-validation-using-DWR...-tp19438106p19438106.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message