You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Nesbitt <sc...@yahoo.com> on 2007/04/05 22:25:37 UTC

S2: Better passing of fields by link

I have a link that calls an action and I would like
the action class to have some field values from my
page.  Currently I do this:

<s:url id="editUrl" action="EditLineup"
includeParams="all"/>
<s:a href="%{editUrl}"
onclick="this.href=rewriteLink(this.href)">Edit
Lineup</s:a>

In rewriteLink() I manually create a list of parameter
key/values.  Is there a better way?  In my
autocompleter tag I can just do formId="dataForm" and
have a small form  with hidden fields that get
automatically serialized and sent to the action class,
but that does not seem to work with the a tag, despite
what the documentation says about ajax.

Any ideas?  Perhaps I am going about this wrong but do
not see any good examples of how to do this.

Thank you,

Scott


 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

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


Re: S2: Better passing of fields by link

Posted by Scott Nesbitt <sc...@yahoo.com>.
Ok, figured it out.  I did try what you mentioned but
it also required this at the top to work:

<s:head theme="ajax"/>

It would not pass the params with just the ajax theme
in the s:a tag.

Thank you for your help.

Scott

--- Musachy Barroso <mu...@gmail.com> wrote:

> What problem are you having? Just do:
> 
> <s:a theme="ajax" formId="form" .. />
> 
> like what you did for the autocompleter, there are a
> few examples on
> showcase also.
> 
> musachy
> 
> On 4/5/07, Scott Nesbitt <sc...@yahoo.com>
> wrote:
> >
> >
> > I have a link that calls an action and I would
> like
> > the action class to have some field values from my
> > page.  Currently I do this:
> >
> > <s:url id="editUrl" action="EditLineup"
> > includeParams="all"/>
> > <s:a href="%{editUrl}"
> > onclick="this.href=rewriteLink(this.href)">Edit
> > Lineup</s:a>
> >
> > In rewriteLink() I manually create a list of
> parameter
> > key/values.  Is there a better way?  In my
> > autocompleter tag I can just do formId="dataForm"
> and
> > have a small form  with hidden fields that get
> > automatically serialized and sent to the action
> class,
> > but that does not seem to work with the a tag,
> despite
> > what the documentation says about ajax.
> >
> > Any ideas?  Perhaps I am going about this wrong
> but do
> > not see any good examples of how to do this.
> >
> > Thank you,
> >
> > Scott
> >
> >
> >
> >
> >
>
____________________________________________________________________________________
> > No need to miss a message. Get email on-the-go
> > with Yahoo! Mail for Mobile. Get started.
> > http://mobile.yahoo.com/mail
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?"
> Pink Floyd
> 



 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

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


Re: S2: Better passing of fields by link

Posted by Musachy Barroso <mu...@gmail.com>.
What problem are you having? Just do:

<s:a theme="ajax" formId="form" .. />

like what you did for the autocompleter, there are a few examples on
showcase also.

musachy

On 4/5/07, Scott Nesbitt <sc...@yahoo.com> wrote:
>
>
> I have a link that calls an action and I would like
> the action class to have some field values from my
> page.  Currently I do this:
>
> <s:url id="editUrl" action="EditLineup"
> includeParams="all"/>
> <s:a href="%{editUrl}"
> onclick="this.href=rewriteLink(this.href)">Edit
> Lineup</s:a>
>
> In rewriteLink() I manually create a list of parameter
> key/values.  Is there a better way?  In my
> autocompleter tag I can just do formId="dataForm" and
> have a small form  with hidden fields that get
> automatically serialized and sent to the action class,
> but that does not seem to work with the a tag, despite
> what the documentation says about ajax.
>
> Any ideas?  Perhaps I am going about this wrong but do
> not see any good examples of how to do this.
>
> Thank you,
>
> Scott
>
>
>
>
> ____________________________________________________________________________________
> No need to miss a message. Get email on-the-go
> with Yahoo! Mail for Mobile. Get started.
> http://mobile.yahoo.com/mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Unable to find resource error after upgrade from S12 to S13

Posted by "Chinenova, Tatyana" <tc...@shsolutions.com>.
I got the following exception after upgrading the project from Struts
1.1 to 1.3:

VelocityViewServlet : Error processing a template for path
'/tile/common/shlogon.vm'
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource '/tile/common/shlogon.vm' at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Re
sourceManagerImpl.java:458)

The exception happens when I try to go to the login page of the
application.

I followed the instructions on
http://wiki.apache.org/struts/StrutsUpgradeNotes12to13  I tried to find
any additional information of Tiles setup with 1.3, but didn't find
anything different from 1.1

I don't think I missed anything, and I have no idea why it cannot find
the file.  The upgrade document in wiki does not say anything about
TilesPlugin.  Do I need to use it, or is there another way of specifying
tile definitions?  I check the path in .war file and shlogon.vm file is
there.

I have the following in my config files:
web.xml:

<servlet>
	    <servlet-name>action</servlet-name>
	
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
	    <init-param>
	      <param-name>config</param-name>
	
<param-value>/WEB-INF/struts-common.xml,/WEB-INF/struts-cam.xml</param-v
alue>
	    </init-param>
  	    <init-param>
	         <param-name>chainConfig</param-name>
	
<param-value>org/apache/struts/tiles/chain-config.xml</param-value>
	    </init-param>	    
.....
struts-common.xml:

 <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config" 
    	value="/WEB-INF/tiles-common.xml,
    			/WEB-INF/tiles-cam.xml" />
.....
tiles-common.xml:

<definition name=".logon" extends=".common.Bundle"
path="/tile/common/shlogon.vm" >
     <put name="header" value="/tile/common/header.vm"/>
     <put name="tabsbar" value="/tile/common/tabsbar.vm"/>
     <put name="taboptions" value="/tile/common/toptions.vm"/>
  </definition>


Any help would be appreciated.


Tatyana Chinenova 

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


Re: S2: Better passing of fields by link

Posted by joey <re...@gmail.com>.
Yes,your method is easier,I just missed your reply.
regards
joey
On 4/6/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> I think it is easier just to use the anchor tag from the ajax theme, which
> already does this.
>
> regards
> musachy
>
> On 4/5/07, joey <re...@gmail.com> wrote:
> >
> > I think you want the a tag having the ajax function like the
> autocompleter
> > tag.
> > You can just use ajax lib javascript like dojo to achieve it.
> > There is the snippet:
> >             function dojoForm(form) {
> >                 var kw = {
> >                     mimetype: "text/plain",
> >                     encoding: 'utf-8',
> >                     formNode: form,
> >                     load: function(type, data, evt) {//callback function
> >
> >                     },
> >                     error: function(t, e) {
> >                         alert("Error!... " + e.message);
> >                     }
> >                 };
> >                 dojo.io.bind(kw);
> >                 return false;
> >             }
> > <s:form action="youraction" id="dataForm"
> >                 onsubmit="try{dojoForm(this)}catch(E){};return false;">
> > <s:a href="%{editUrl}"
> > onclick="this.form.submit()">Edit
> > Lineup</s:a>
> > For details,you can see the showcase app or dojo documentation.
> >
> >
> > On 4/6/07, Scott Nesbitt <sc...@yahoo.com> wrote:
> > >
> > >
> > > I have a link that calls an action and I would like
> > > the action class to have some field values from my
> > > page.  Currently I do this:
> > >
> > > <s:url id="editUrl" action="EditLineup"
> > > includeParams="all"/>
> > > <s:a href="%{editUrl}"
> > > onclick="this.href=rewriteLink(this.href)">Edit
> > > Lineup</s:a>
> > >
> > > In rewriteLink() I manually create a list of parameter
> > > key/values.  Is there a better way?  In my
> > > autocompleter tag I can just do formId="dataForm" and
> > > have a small form  with hidden fields that get
> > > automatically serialized and sent to the action class,
> > > but that does not seem to work with the a tag, despite
> > > what the documentation says about ajax.
> > >
> > > Any ideas?  Perhaps I am going about this wrong but do
> > > not see any good examples of how to do this.
> > >
> > > Thank you,
> > >
> > > Scott
> > >
> > >
> > >
> > >
> > >
> >
> ____________________________________________________________________________________
> > > No need to miss a message. Get email on-the-go
> > > with Yahoo! Mail for Mobile. Get started.
> > > http://mobile.yahoo.com/mail
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>

Re: S2: Better passing of fields by link

Posted by Musachy Barroso <mu...@gmail.com>.
I think it is easier just to use the anchor tag from the ajax theme, which
already does this.

regards
musachy

On 4/5/07, joey <re...@gmail.com> wrote:
>
> I think you want the a tag having the ajax function like the autocompleter
> tag.
> You can just use ajax lib javascript like dojo to achieve it.
> There is the snippet:
>             function dojoForm(form) {
>                 var kw = {
>                     mimetype: "text/plain",
>                     encoding: 'utf-8',
>                     formNode: form,
>                     load: function(type, data, evt) {//callback function
>
>                     },
>                     error: function(t, e) {
>                         alert("Error!... " + e.message);
>                     }
>                 };
>                 dojo.io.bind(kw);
>                 return false;
>             }
> <s:form action="youraction" id="dataForm"
>                 onsubmit="try{dojoForm(this)}catch(E){};return false;">
> <s:a href="%{editUrl}"
> onclick="this.form.submit()">Edit
> Lineup</s:a>
> For details,you can see the showcase app or dojo documentation.
>
>
> On 4/6/07, Scott Nesbitt <sc...@yahoo.com> wrote:
> >
> >
> > I have a link that calls an action and I would like
> > the action class to have some field values from my
> > page.  Currently I do this:
> >
> > <s:url id="editUrl" action="EditLineup"
> > includeParams="all"/>
> > <s:a href="%{editUrl}"
> > onclick="this.href=rewriteLink(this.href)">Edit
> > Lineup</s:a>
> >
> > In rewriteLink() I manually create a list of parameter
> > key/values.  Is there a better way?  In my
> > autocompleter tag I can just do formId="dataForm" and
> > have a small form  with hidden fields that get
> > automatically serialized and sent to the action class,
> > but that does not seem to work with the a tag, despite
> > what the documentation says about ajax.
> >
> > Any ideas?  Perhaps I am going about this wrong but do
> > not see any good examples of how to do this.
> >
> > Thank you,
> >
> > Scott
> >
> >
> >
> >
> >
> ____________________________________________________________________________________
> > No need to miss a message. Get email on-the-go
> > with Yahoo! Mail for Mobile. Get started.
> > http://mobile.yahoo.com/mail
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: S2: Better passing of fields by link

Posted by joey <re...@gmail.com>.
I think you want the a tag having the ajax function like the autocompleter
tag.
You can just use ajax lib javascript like dojo to achieve it.
There is the snippet:
            function dojoForm(form) {
                var kw = {
                    mimetype: "text/plain",
                    encoding: 'utf-8',
                    formNode: form,
                    load: function(type, data, evt) {//callback function

                    },
                    error: function(t, e) {
                        alert("Error!... " + e.message);
                    }
                };
                dojo.io.bind(kw);
                return false;
            }
<s:form action="youraction" id="dataForm"
                onsubmit="try{dojoForm(this)}catch(E){};return false;">
<s:a href="%{editUrl}"
onclick="this.form.submit()">Edit
Lineup</s:a>
For details,you can see the showcase app or dojo documentation.


On 4/6/07, Scott Nesbitt <sc...@yahoo.com> wrote:
>
>
> I have a link that calls an action and I would like
> the action class to have some field values from my
> page.  Currently I do this:
>
> <s:url id="editUrl" action="EditLineup"
> includeParams="all"/>
> <s:a href="%{editUrl}"
> onclick="this.href=rewriteLink(this.href)">Edit
> Lineup</s:a>
>
> In rewriteLink() I manually create a list of parameter
> key/values.  Is there a better way?  In my
> autocompleter tag I can just do formId="dataForm" and
> have a small form  with hidden fields that get
> automatically serialized and sent to the action class,
> but that does not seem to work with the a tag, despite
> what the documentation says about ajax.
>
> Any ideas?  Perhaps I am going about this wrong but do
> not see any good examples of how to do this.
>
> Thank you,
>
> Scott
>
>
>
>
> ____________________________________________________________________________________
> No need to miss a message. Get email on-the-go
> with Yahoo! Mail for Mobile. Get started.
> http://mobile.yahoo.com/mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>