You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marc Ende <ml...@e-beyond.de> on 2008/04/06 10:23:34 UTC

Url-Parameters only set once

Hi,

I've got a list with several items which are linked to a details-action.
If I klick on an item after the restart of the webapp a link like
http://.../details.action?id=123
is called. Everything is fine. I can see the correct details site.
When I go back and klick on another item (with another id)
the old id is called from the database and shown.

Within the action I've declared an
private String id;
with the getters and setters.
The logic (retrieval data from the database) is done in the execute
method.

Is there any caching or do I have to set id manually to null?
Or do I have to do the processing in the prepare-method?

Thanks for your help

Marc

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


RE: Url-Parameters only set once

Posted by Eric Nelson <er...@unishippers.com>.
Ah, you're right.  Thanks for the correction.

--Eric

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Monday, April 07, 2008 9:29 AM
To: Struts Users Mailing List
Subject: RE: Url-Parameters only set once

--- Eric Nelson <er...@unishippers.com> wrote:
> You CAN set the property to a different value every time.  Most of my
> action beans implement this behavior just fine.  Did you make sure
your
> action bean implements the ParameterAware interface?  This binds your
> action bean properties to the current values in the request scope.

Just for completeness, ParameterAware is for getting the map of
parameters,
not for binding those parameters to action properties.

Dave


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


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


Re: Url-Parameters only set once

Posted by Dave Newton <ne...@yahoo.com>.
--- me <ml...@e-beyond.de> wrote:
> Yes of course that's what I thougt. But when I change the scope of the 
> spring bean to default I could provide the id using a get request but 
> nothing happens.
> 
> Now I keep it on prototype which is okay for this page.

S2 assumes a new action will be created for every request... Not doing so is
almost certainly a Bad Idea.

I'm sure it's possible, but it runs contrary to everything the framework
assumes about application structure.

Dave


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


Re: Url-Parameters only set once

Posted by me <ml...@e-beyond.de>.
Yes of course that's what I thougt. But when I change the scope of the 
spring bean to default
I could provide the id using a get request but nothing happens.

Now I keep it on prototype which is okay for this page.

Marc

Eric Nelson schrieb:
> You CAN set the property to a different value every time.  Most of my
> action beans implement this behavior just fine.  Did you make sure your
> action bean implements the ParameterAware interface?  This binds your
> action bean properties to the current values in the request scope.
>
> --Eric
>
> -----Original Message-----
> From: Marc Ende [mailto:mlists@e-beyond.de] 
> Sent: Sunday, April 06, 2008 1:19 PM
> To: Struts Users Mailing List
> Subject: Re: Url-Parameters only set once
>
> Hello Dave,
>
> I've found a solution for that. The spring-action was standard-scoped 
> and in cause of that it didn't accept the
> id parameter a second time.
>
> I think it's a little bit strange that it's impossible to set an 
> property again when it's done before.
>
> Marc
>
>
>
>
> Dave Newton schrieb:
>   
>> --- Marc Ende <ml...@e-beyond.de> wrote:
>>   
>>     
>>> I've got a list with several items which are linked to a
>>>       
> details-action.
>   
>>> If I klick on an item after the restart of the webapp a link like
>>> http://.../details.action?id=123
>>> is called. Everything is fine. I can see the correct details site.
>>> When I go back and klick on another item (with another id)
>>> the old id is called from the database and shown.
>>>     
>>>       
>> Without any further info it's hard to say what the problem might be.
>>
>> Actions are instantiated per-request, unless you've mis-configured a
>> Spring-defined action.
>>
>> Depending on how you're creating the links (and how your application
>>     
> is laid
>   
>> out) you may be getting URL parameters you're not expecting in your
>>     
> link;
>   
>> <s:url...> has an "includeParams" attribute you might want to look at.
>>
>> I'm sure there are more possibilities, but we might need more info in
>>     
> order
>   
>> to help.
>>
>> Dave
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


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


RE: Url-Parameters only set once

Posted by Dave Newton <ne...@yahoo.com>.
--- Eric Nelson <er...@unishippers.com> wrote:
> You CAN set the property to a different value every time.  Most of my
> action beans implement this behavior just fine.  Did you make sure your
> action bean implements the ParameterAware interface?  This binds your
> action bean properties to the current values in the request scope.

Just for completeness, ParameterAware is for getting the map of parameters,
not for binding those parameters to action properties.

Dave


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


RE: Url-Parameters only set once

Posted by Eric Nelson <er...@unishippers.com>.
You CAN set the property to a different value every time.  Most of my
action beans implement this behavior just fine.  Did you make sure your
action bean implements the ParameterAware interface?  This binds your
action bean properties to the current values in the request scope.

--Eric

-----Original Message-----
From: Marc Ende [mailto:mlists@e-beyond.de] 
Sent: Sunday, April 06, 2008 1:19 PM
To: Struts Users Mailing List
Subject: Re: Url-Parameters only set once

Hello Dave,

I've found a solution for that. The spring-action was standard-scoped 
and in cause of that it didn't accept the
id parameter a second time.

I think it's a little bit strange that it's impossible to set an 
property again when it's done before.

Marc




Dave Newton schrieb:
> --- Marc Ende <ml...@e-beyond.de> wrote:
>   
>> I've got a list with several items which are linked to a
details-action.
>> If I klick on an item after the restart of the webapp a link like
>> http://.../details.action?id=123
>> is called. Everything is fine. I can see the correct details site.
>> When I go back and klick on another item (with another id)
>> the old id is called from the database and shown.
>>     
>
> Without any further info it's hard to say what the problem might be.
>
> Actions are instantiated per-request, unless you've mis-configured a
> Spring-defined action.
>
> Depending on how you're creating the links (and how your application
is laid
> out) you may be getting URL parameters you're not expecting in your
link;
> <s:url...> has an "includeParams" attribute you might want to look at.
>
> I'm sure there are more possibilities, but we might need more info in
order
> to help.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


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


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


Re: Url-Parameters only set once

Posted by Marc Ende <ml...@e-beyond.de>.
Hello Dave,

I've found a solution for that. The spring-action was standard-scoped 
and in cause of that it didn't accept the
id parameter a second time.

I think it's a little bit strange that it's impossible to set an 
property again when it's done before.

Marc




Dave Newton schrieb:
> --- Marc Ende <ml...@e-beyond.de> wrote:
>   
>> I've got a list with several items which are linked to a details-action.
>> If I klick on an item after the restart of the webapp a link like
>> http://.../details.action?id=123
>> is called. Everything is fine. I can see the correct details site.
>> When I go back and klick on another item (with another id)
>> the old id is called from the database and shown.
>>     
>
> Without any further info it's hard to say what the problem might be.
>
> Actions are instantiated per-request, unless you've mis-configured a
> Spring-defined action.
>
> Depending on how you're creating the links (and how your application is laid
> out) you may be getting URL parameters you're not expecting in your link;
> <s:url...> has an "includeParams" attribute you might want to look at.
>
> I'm sure there are more possibilities, but we might need more info in order
> to help.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


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


Re: Url-Parameters only set once

Posted by Dave Newton <ne...@yahoo.com>.
--- Marc Ende <ml...@e-beyond.de> wrote:
> I've got a list with several items which are linked to a details-action.
> If I klick on an item after the restart of the webapp a link like
> http://.../details.action?id=123
> is called. Everything is fine. I can see the correct details site.
> When I go back and klick on another item (with another id)
> the old id is called from the database and shown.

Without any further info it's hard to say what the problem might be.

Actions are instantiated per-request, unless you've mis-configured a
Spring-defined action.

Depending on how you're creating the links (and how your application is laid
out) you may be getting URL parameters you're not expecting in your link;
<s:url...> has an "includeParams" attribute you might want to look at.

I'm sure there are more possibilities, but we might need more info in order
to help.

Dave



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