You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by st...@spamgourmet.com on 2011/06/01 17:51:19 UTC

Hash tags

Does the redirectAction result support a parameter or attribute defining a hash tag to append?

For example, this:
<result name="success" type="redirectAction" hash="userPreferences">viewuser</result>

Might yield:
   /context/viewuser.action#userPreferences

I don't see any such thing on the document:
   http://struts.apache.org/2.2.3/docs/redirect-action-result.html

Thank you,
-Roland

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


Re: Hash tags

Posted by Dave Newton <da...@gmail.com>.
On Wed, Jun 1, 2011 at 1:24 PM, Jason Pyeron wrote:
>> From: struts.rgm@spamgourmet.com
>> The example at the bottom is clearly intended to be a
>> "complete" example, but ignores the attributes supported by
>> the extended class:
>>
>> .../2.2.3/struts2-core/apidocs/org/apache/struts2/dispatcher/ServletRedirectResult.html
>
> Could you explain that statement?

Probably "you show an example of it in the redirect result Javadocs
and wiki docs, but not in the redirectAction result (which extends the
base redirect result)".

Dave

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


Re: Hash tags

Posted by Jeff Black <je...@yahoo.com>.
I would be happy to take on this task.  I recently was "upgraded" and looking for opportunties to dive in.


From: "struts.rgm@spamgourmet.com" <st...@spamgourmet.com>
To: user@struts.apache.org
Sent: Wednesday, June 1, 2011 12:45 PM
Subject: Re: Hash tags

Yes, I believe the document should be updated to add an anchor example.  As Dave mentioned, I'll file a JIRA ticket for that.

Explaining my other sentence, I saw that the extended class also supported the "location" and "parse" parameters in addition to "anchor."
However, the constructor for the ServletActionRedirectResult doesn't look at these, so I'm not sure if they're usable in <param> elements -- especially since "location" is the same thing as "actionName."

I just meant that these other parameters ought to be mentioned in the docs too, IF it turns out that they're usable.
Maybe a section could be added entitled:

Additional Parameters (Inherited from ServletRedirectResult)
* location - same as actionName (do not use).  The location to go to after execution.
* parse - boolean, true by default.  If set to false, the location param will not be parsed for Ognl expressions
* anchor - optional.  Also known as "fragment" or colloquially as "hash."  You can specify an anchor for a result.

On Jun 1, 2011, at 12:24 PM, Jason Pyeron - jpyeron@pdinc.us wrote:

>> -----Original Message-----
>> From: struts.rgm@spamgourmet.com
>> Sent: Wednesday, June 01, 2011 12:59
>> To: user@struts.apache.org
>> Subject: Re: Hash tags
>> 
>> I tried that first, but it yields 
>> "viewuser#userPreferences.action."  I found the answer by 
>> diving into the source code.  The key insight is that this is 
>> called an "anchor" (not a hash).
>> This works:
>> 
>> <result name="success" type="redirectAction">
>>  <param name="actionName">viewuser</param>
>>  <param name="anchor">userPreferences</param>
>> </result>
>> 
>> This document should be updated:
>> http://struts.apache.org/2.2.3/docs/redirect-action-result.html
> 
> To add an anchor example?
> 
>> 
>> The example at the bottom is clearly intended to be a 
>> "complete" example, but ignores the attributes supported by 
>> the extended class:
>> 
> http://struts.apache.org/2.2.3/struts2-core/apidocs/org/apache/struts2/dispatche
> r/ServletRedirectResult.html
> 
> Could you explain that statement?
> 
> 
> 
> --
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> -                                                              -
> - Jason Pyeron                      PD Inc. http://www.pdinc.us -
> - Principal Consultant              10 West 24th Street #100    -
> - +1 (443) 269-1555 x333            Baltimore, Maryland 21218  -
> -                                                              -
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> This message is copyright PD Inc, subject to license 20080407P00.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Hash tags

Posted by st...@spamgourmet.com.
Yes, I believe the document should be updated to add an anchor example.  As Dave mentioned, I'll file a JIRA ticket for that.

Explaining my other sentence, I saw that the extended class also supported the "location" and "parse" parameters in addition to "anchor."
However, the constructor for the ServletActionRedirectResult doesn't look at these, so I'm not sure if they're usable in <param> elements -- especially since "location" is the same thing as "actionName."

I just meant that these other parameters ought to be mentioned in the docs too, IF it turns out that they're usable.
Maybe a section could be added entitled:

Additional Parameters (Inherited from ServletRedirectResult)
* location - same as actionName (do not use).  The location to go to after execution.
* parse - boolean, true by default.  If set to false, the location param will not be parsed for Ognl expressions
* anchor - optional.  Also known as "fragment" or colloquially as "hash."  You can specify an anchor for a result.

On Jun 1, 2011, at 12:24 PM, Jason Pyeron - jpyeron@pdinc.us wrote:

>> -----Original Message-----
>> From: struts.rgm@spamgourmet.com
>> Sent: Wednesday, June 01, 2011 12:59
>> To: user@struts.apache.org
>> Subject: Re: Hash tags
>> 
>> I tried that first, but it yields 
>> "viewuser#userPreferences.action."  I found the answer by 
>> diving into the source code.  The key insight is that this is 
>> called an "anchor" (not a hash).
>> This works:
>> 
>> <result name="success" type="redirectAction">
>>  <param name="actionName">viewuser</param>
>>  <param name="anchor">userPreferences</param>
>> </result>
>> 
>> This document should be updated:
>> http://struts.apache.org/2.2.3/docs/redirect-action-result.html
> 
> To add an anchor example?
> 
>> 
>> The example at the bottom is clearly intended to be a 
>> "complete" example, but ignores the attributes supported by 
>> the extended class:
>> 
> http://struts.apache.org/2.2.3/struts2-core/apidocs/org/apache/struts2/dispatche
> r/ServletRedirectResult.html
> 
> Could you explain that statement?
> 
> 
> 
> --
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> -                                                               -
> - Jason Pyeron                      PD Inc. http://www.pdinc.us -
> - Principal Consultant              10 West 24th Street #100    -
> - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
> -                                                               -
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> This message is copyright PD Inc, subject to license 20080407P00.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Hash tags

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: struts.rgm@spamgourmet.com
> Sent: Wednesday, June 01, 2011 12:59
> To: user@struts.apache.org
> Subject: Re: Hash tags
> 
> I tried that first, but it yields 
> "viewuser#userPreferences.action."  I found the answer by 
> diving into the source code.  The key insight is that this is 
> called an "anchor" (not a hash).
> This works:
> 
> <result name="success" type="redirectAction">
>   <param name="actionName">viewuser</param>
>   <param name="anchor">userPreferences</param>
> </result>
> 
> This document should be updated:
> http://struts.apache.org/2.2.3/docs/redirect-action-result.html

To add an anchor example?

> 
> The example at the bottom is clearly intended to be a 
> "complete" example, but ignores the attributes supported by 
> the extended class:
>
http://struts.apache.org/2.2.3/struts2-core/apidocs/org/apache/struts2/dispatche
r/ServletRedirectResult.html

Could you explain that statement?



--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 


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


Re: Hash tags

Posted by Dave Newton <da...@gmail.com>.
On Wed, Jun 1, 2011 at 12:59 PM,  <st...@spamgourmet.com> wrote:
> The key insight is that this is called an "anchor" (not a hash). This works:

Cool, I don't even know if I ever knew that.

> This document should be updated:
> http://struts.apache.org/2.2.3/docs/redirect-action-result.html

Best ways to go about doing that, in order:

- File a CLA and get wiki edit rights
- Open a JIRA ticket against the documentation

Mentioning it here works sometimes, a comment on the wiki page also
helps sometimes.

Personally I like having a JIRA ticket for it for tracking purposes,
at least if someone isn't going to volunteer to do it.

Dave

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


Re: Hash tags

Posted by st...@spamgourmet.com.
I tried that first, but it yields "viewuser#userPreferences.action."  I found the answer by diving into the source code.  The key insight is that this is called an "anchor" (not a hash).
This works:

<result name="success" type="redirectAction">
  <param name="actionName">viewuser</param>
  <param name="anchor">userPreferences</param>
</result>

This document should be updated:
http://struts.apache.org/2.2.3/docs/redirect-action-result.html

The example at the bottom is clearly intended to be a "complete" example, but ignores the attributes supported by the extended class:
http://struts.apache.org/2.2.3/struts2-core/apidocs/org/apache/struts2/dispatcher/ServletRedirectResult.html


On Jun 1, 2011, at 11:43 AM, Dave Newton - davelnewton@gmail.com wrote:

> On Wed, Jun 1, 2011 at 11:51 AM,  wrote:
>> Does the redirectAction result support [...] a hash tag to append?
>> 
>> For example, this:
>> <result name="success" type="redirectAction" hash="userPreferences">viewuser</result>
> 
> What happens when you try it?
> 
> Did you try <result ...>viewuser#userPreferences</result>? I don't
> know if that'd work or not, but easy enough to find out.
> 
> 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: Hash tags

Posted by Dave Newton <da...@gmail.com>.
On Wed, Jun 1, 2011 at 11:51 AM,  wrote:
> Does the redirectAction result support [...] a hash tag to append?
>
> For example, this:
> <result name="success" type="redirectAction" hash="userPreferences">viewuser</result>

What happens when you try it?

Did you try <result ...>viewuser#userPreferences</result>? I don't
know if that'd work or not, but easy enough to find out.

Dave

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