You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeancarlo <je...@gmail.com> on 2007/12/29 15:30:46 UTC

form submission doesn't work with ajax theme

Hello,

I'm using struts version 2.0.11 and dwr. The field validation and form
submission and everything work fine (I'm using the tag <s:head /> without
any parameters). It did work until I wanted to use the autocomplete struts
tag. To use that I need to add theme="ajax" in the s:head tag, right?
However, when I did so, everything stopped to work: validation, form
submission. When I click in the submission button, it seems to work, because
I can see through the console that it goes to the server but the page
doesn't change. Am I missing something about how to configure the actions to
work with ajax/dwr?

Thank you in advance,
Jeancarlo.
Happy new year!

Re: form submission doesn't work with ajax theme

Posted by Jeancarlo <je...@gmail.com>.
Hi,

   I'm using maven, the version of maven is 2.0.8. The jvm version is
1.6.0_03. The struts version is 2.0.11 and the dwr version I changed to
1.1.3. The jetty version is 6.1H.5-beta.
I don't have the autocompleter in that page, although I'm going to use it
and I'll change the class to delivering in json formatted resultset, too.
But one problem at a time, right now, I just want to submit the form with
ajax and that's not working, snif. I changed the dwr from 1.1.4 to version
1.1.3 and then to 2.0.1 in the pom.xml, and it didn't work, although the
field validation is working fine.

The pom.xml file is attached.

Thanks,
Jeancarlo.
Happy new year!

2007/12/30, Martin Gainty <mg...@hotmail.com>:
>
>
> what version jetty?
> what version maven?also could you attach poms to build with mavencheck the
> repositories for online status. if some of the repositories went offline
> then the build will break
> autocomplete has an href attribute which I would point to the action class
> delivering json formatted resultset..is your server class delivering in
> json?
> http://struts.apache.org/2.0.11/docs/autocompleter.html
> Nouvelle Année Heureuse
> Martin______________________________________________Disclaimer and
> confidentiality noteEverything in this e-mail and any attachments relates to
> the official business of Sender. This transmission is of a confidential
> nature and Sender does not endorse distribution to any party other than
> intended recipient. Sender does not necessarily endorse content contained
> within this transmission.> Date: Sun, 30 Dec 2007 13:27:41 -0200> From:
> jean.adri@gmail.com> To: user@struts.apache.org> Subject: Re: form
> submission doesn't work with ajax theme> > Hi,> > Thank you for your input.
> The jvm version is 1.6.0_03. The struts version> is 2.0.11 and dwr version
> is 1.1.4. I'm using maven to build the application> and jetty is the web
> server. Below there are snippets from some of the> configuration files.> >
> dwr.xml:> <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>> > 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>> > the struts.xml:> <action name="person.save"
> method="save" class="personAction" >> <result
> name="input">pages/person/insert.jsp</result>> <result
> name="success">pages/person/insert.jsp</result>> </action>> >
> http://localhost:8080/mywebapp/dwr/:> The dwr page worked fine, and the
> page suggested to use some javascripts> like:> > <script
> type="text/javascript"> src="/wancrm/dwr/interface/validator.js"></script>>
> <script type="text/javascript" src="/wancrm/dwr/engine.js"></script>> > And
> that was exactly what I saw in the html source of the generated page of> my
> application.> > And my insert.jsp page:> <html xmlns="
> http://www.w3.org/1999/xhtml">> <head>> <s:head theme="ajax"
> debug="true"/>> </head>> <body>> <s:form theme="ajax" action="person.save"
> validate="true">> <s:textfield label="Name" name="firstName" />>
> <s:textfield label="Last name" name="lastName" />> <s:submit value="Save"/>>
> </s:form>> </body>> </html>> > Just an observation: firstName and lastName
> are not strings, both are plain> java classes and I have properly configured
> converters for them and are> working fine.> > I'm just wondering what's
> wrong, am I missing something?> > Thank you,> Jeancarlo.> Happy new year!> >
> > 2007/12/29, Martin Gainty <mg...@hotmail.com>:> >> >> > JVM?> > TC
> version?> > Struts version?> > implemented DWR? pleas display servlet
> configurationalso it would be> > helpful to see contents of dwr.xml> >
> display the contents of JS functions available> >
> athttp://localhost:8080/[YOUR-WEBAPP]/dwr/> >> > This troubleshhooting page
> may help somewhat with possible environmental> > issues> >
> http://getahead.org/dwr/fixes> >
> Thanks/Martin______________________________________________Disclaimer and> >
> confidentiality noteEverything in this e-mail and any attachments relates
> to> > the official business of Sender. This transmission is of a
> confidential> > nature and Sender does not endorse distribution to any party
> other than> > intended recipient. Sender does not necessarily endorse
> content contained> > within this transmission.> Date: Sat, 29 Dec 2007
> 12:30:46 -0200> From:> > jean.adri@gmail.com> To: user@struts.apache.org>
> Subject: form submission> > doesn't work with ajax theme> > Hello,> > I'm
> using struts version 2.0.11and dwr. The field validation and form>
> submission and everything work fine> > (I'm using the tag <s:head />
> without> any parameters). It did work until I> > wanted to use the
> autocomplete struts> tag. To use that I need to add> > theme="ajax" in the
> s:head tag, right?> However, when I did so, everything> > stopped to work:
> validation, form> submission. When I click in the> > submission button, it
> seems to work, because> I can see through the console> > that it goes to the
> server but the page> doesn't change. Am I missing> > something about how to
> configure the actions to> work with ajax/dwr?> >> > Thank you in advance,>
> Jeancarlo.> Happy new year!> >
> _________________________________________________________________> > The
> best games are on Xbox 360. Click here for a special offer on an Xbox> > 360
> Console.> > http://www.xbox.com/en-US/hardware/wheretobuy/
> _________________________________________________________________
> Don't get caught with egg on your face. Play Chicktionary!
> http://club.live.com/chicktionary.aspx?icid=chick_wlhmtextlink1_dec

RE: form submission doesn't work with ajax theme

Posted by Martin Gainty <mg...@hotmail.com>.
what version jetty?
what version maven?also could you attach poms to build with mavencheck the repositories for online status. if some of the repositories went offline then the build will break
autocomplete has an href attribute which I would point to the action class delivering json formatted resultset..is your server class delivering in json?
http://struts.apache.org/2.0.11/docs/autocompleter.html
Nouvelle Année Heureuse
Martin______________________________________________Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> Date: Sun, 30 Dec 2007 13:27:41 -0200> From: jean.adri@gmail.com> To: user@struts.apache.org> Subject: Re: form submission doesn't work with ajax theme> > Hi,> > Thank you for your input. The jvm version is 1.6.0_03. The struts version> is 2.0.11 and dwr version is 1.1.4. I'm using maven to build the application> and jetty is the web server. Below there are snippets from some of the> configuration files.> > dwr.xml:> <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>> > 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>> > the struts.xml:> <action name="person.save" method="save" class="personAction" >> <result name="input">pages/person/insert.jsp</result>> <result name="success">pages/person/insert.jsp</result>> </action>> > http://localhost:8080/mywebapp/dwr/:> The dwr page worked fine, and the page suggested to use some javascripts> like:> > <script type="text/javascript"> src="/wancrm/dwr/interface/validator.js"></script>> <script type="text/javascript" src="/wancrm/dwr/engine.js"></script>> > And that was exactly what I saw in the html source of the generated page of> my application.> > And my insert.jsp page:> <html xmlns="http://www.w3.org/1999/xhtml">> <head>> <s:head theme="ajax" debug="true"/>> </head>> <body>> <s:form theme="ajax" action="person.save" validate="true">> <s:textfield label="Name" name="firstName" />> <s:textfield label="Last name" name="lastName" />> <s:submit value="Save"/>> </s:form>> </body>> </html>> > Just an observation: firstName and lastName are not strings, both are plain> java classes and I have properly configured converters for them and are> working fine.> > I'm just wondering what's wrong, am I missing something?> > Thank you,> Jeancarlo.> Happy new year!> > > 2007/12/29, Martin Gainty <mg...@hotmail.com>:> >> >> > JVM?> > TC version?> > Struts version?> > implemented DWR? pleas display servlet configurationalso it would be> > helpful to see contents of dwr.xml> > display the contents of JS functions available> > athttp://localhost:8080/[YOUR-WEBAPP]/dwr/> >> > This troubleshhooting page may help somewhat with possible environmental> > issues> > http://getahead.org/dwr/fixes> > Thanks/Martin______________________________________________Disclaimer and> > confidentiality noteEverything in this e-mail and any attachments relates to> > the official business of Sender. This transmission is of a confidential> > nature and Sender does not endorse distribution to any party other than> > intended recipient. Sender does not necessarily endorse content contained> > within this transmission.> Date: Sat, 29 Dec 2007 12:30:46 -0200> From:> > jean.adri@gmail.com> To: user@struts.apache.org> Subject: form submission> > doesn't work with ajax theme> > Hello,> > I'm using struts version 2.0.11and dwr. The field validation and form> submission and everything work fine> > (I'm using the tag <s:head /> without> any parameters). It did work until I> > wanted to use the autocomplete struts> tag. To use that I need to add> > theme="ajax" in the s:head tag, right?> However, when I did so, everything> > stopped to work: validation, form> submission. When I click in the> > submission button, it seems to work, because> I can see through the console> > that it goes to the server but the page> doesn't change. Am I missing> > something about how to configure the actions to> work with ajax/dwr?> >> > Thank you in advance,> Jeancarlo.> Happy new year!> > _________________________________________________________________> > The best games are on Xbox 360. Click here for a special offer on an Xbox> > 360 Console.> > http://www.xbox.com/en-US/hardware/wheretobuy/
_________________________________________________________________
Don't get caught with egg on your face. Play Chicktionary!
http://club.live.com/chicktionary.aspx?icid=chick_wlhmtextlink1_dec

Re: form submission doesn't work with ajax theme

Posted by Jeancarlo <je...@gmail.com>.
Hi,

  Thank you for your input. The jvm version is 1.6.0_03. The struts version
is 2.0.11 and dwr version is 1.1.4. I'm using maven to build the application
and jetty is the web server. Below there are snippets from some of the
configuration files.

dwr.xml:
<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>

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>

the struts.xml:
<action name="person.save" method="save" class="personAction" >
            <result name="input">pages/person/insert.jsp</result>
            <result name="success">pages/person/insert.jsp</result>
</action>

http://localhost:8080/mywebapp/dwr/:
The dwr page worked fine, and the page suggested to use some javascripts
like:

<script type="text/javascript"
src="/wancrm/dwr/interface/validator.js"></script>
<script type="text/javascript" src="/wancrm/dwr/engine.js"></script>

And that was exactly what I saw in the html source of the generated page of
my application.

And my insert.jsp page:
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
       <s:head theme="ajax" debug="true"/>
    </head>
<body>
        <s:form theme="ajax" action="person.save" validate="true">
            <s:textfield label="Name" name="firstName" />
            <s:textfield label="Last name" name="lastName" />
            <s:submit value="Save"/>
        </s:form>
</body>
</html>

Just an observation: firstName and lastName are not strings, both are plain
java classes and I have properly configured converters for them and are
working fine.

I'm just wondering what's wrong, am I missing something?

Thank you,
Jeancarlo.
Happy new year!


2007/12/29, Martin Gainty <mg...@hotmail.com>:
>
>
> JVM?
> TC version?
> Struts version?
> implemented DWR? pleas display servlet configurationalso it would be
> helpful to see contents of dwr.xml
> display the contents of JS functions available
> athttp://localhost:8080/[YOUR-WEBAPP]/dwr/
>
> This troubleshhooting page may help somewhat with possible environmental
> issues
> http://getahead.org/dwr/fixes
> Thanks/Martin______________________________________________Disclaimer and
> confidentiality noteEverything in this e-mail and any attachments relates to
> the official business of Sender. This transmission is of a confidential
> nature and Sender does not endorse distribution to any party other than
> intended recipient. Sender does not necessarily endorse content contained
> within this transmission.> Date: Sat, 29 Dec 2007 12:30:46 -0200> From:
> jean.adri@gmail.com> To: user@struts.apache.org> Subject: form submission
> doesn't work with ajax theme> > Hello,> > I'm using struts version 2.0.11and dwr. The field validation and form> submission and everything work fine
> (I'm using the tag <s:head /> without> any parameters). It did work until I
> wanted to use the autocomplete struts> tag. To use that I need to add
> theme="ajax" in the s:head tag, right?> However, when I did so, everything
> stopped to work: validation, form> submission. When I click in the
> submission button, it seems to work, because> I can see through the console
> that it goes to the server but the page> doesn't change. Am I missing
> something about how to configure the actions to> work with ajax/dwr?> >
> Thank you in advance,> Jeancarlo.> Happy new year!
> _________________________________________________________________
> The best games are on Xbox 360.  Click here for a special offer on an Xbox
> 360 Console.
> http://www.xbox.com/en-US/hardware/wheretobuy/

RE: form submission doesn't work with ajax theme

Posted by Martin Gainty <mg...@hotmail.com>.
JVM?
TC version?
Struts version?
implemented DWR? pleas display servlet configurationalso it would be helpful to see contents of dwr.xml
display the contents of JS functions available athttp://localhost:8080/[YOUR-WEBAPP]/dwr/
 
This troubleshhooting page may help somewhat with possible environmental issues
http://getahead.org/dwr/fixes
Thanks/Martin______________________________________________Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> Date: Sat, 29 Dec 2007 12:30:46 -0200> From: jean.adri@gmail.com> To: user@struts.apache.org> Subject: form submission doesn't work with ajax theme> > Hello,> > I'm using struts version 2.0.11 and dwr. The field validation and form> submission and everything work fine (I'm using the tag <s:head /> without> any parameters). It did work until I wanted to use the autocomplete struts> tag. To use that I need to add theme="ajax" in the s:head tag, right?> However, when I did so, everything stopped to work: validation, form> submission. When I click in the submission button, it seems to work, because> I can see through the console that it goes to the server but the page> doesn't change. Am I missing something about how to configure the actions to> work with ajax/dwr?> > Thank you in advance,> Jeancarlo.> Happy new year!
_________________________________________________________________
The best games are on Xbox 360.  Click here for a special offer on an Xbox 360 Console.
http://www.xbox.com/en-US/hardware/wheretobuy/

Re: form submission doesn't work with ajax theme

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Jeancarlo wrote:
> Hello,
>
> I'm using struts version 2.0.11 and dwr. The field validation and form
> submission and everything work fine (I'm using the tag <s:head /> without
> any parameters). It did work until I wanted to use the autocomplete struts
> tag. To use that I need to add theme="ajax" in the s:head tag, right?
> However, when I did so, everything stopped to work: validation, form
> submission. When I click in the submission button, it seems to work, because
> I can see through the console that it goes to the server but the page
> doesn't change. Am I missing something about how to configure the actions to
> work with ajax/dwr?
>
> Thank you in advance,
> Jeancarlo.
> Happy new year!
>
>   
Hi Jeancarlo,
When you had just <s:head/> all your tags were using the default theme 
(usually xhtml) and were working.
When you changed it to <s:head theme="ajax">, all your tags started 
using the ajax theme and stopped working.

It sounds like you require all your existing tags to use xhtml, and only 
the autocompleter tag to use the ajax theme.

Two options:
  - use <s:head theme="ajax">, then modify all existing tags to use the 
xhtml theme (theme="xhtml"); or
  - use <s:head/> but add the javascript directly to your page to enable 
the autocompleter (see the html output when theme="html").  Set the 
autocompleter to use theme="ajax" only.


It should be possible to get all tags to work with theme="ajax" but 
you'll have to check what changed in the rendered html.

Hope that helps,
Jeromy Evans


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