You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gonçalo Luiz <go...@gmail.com> on 2007/02/04 17:09:32 UTC

Producing links

Hello,

Even though the method I'm using to produce links is working, I think
of it like a little bit awkward.

An example of what I'm saying is:

<a href="<s:url action="preferences_prepare"/>">
<s:text name="preferences" />
</a>


Is there a more "elegant" way of producing links that does not involve
this "sub-tag" schema ?


Thank you.

Best Regards,
-- 
Gonçalo Luiz

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


Re: Producing links

Posted by Tom Schneider <sc...@gmail.com>.
Joe you're assessment is correct.  There is usually a 1 to 1 mapping 
between JSP tag and UI component.  Right now the form tag and url tag 
duplicate several pieces of key url building logic.  I spent some time 
abstracting away url building this weekend.  I'm not far enough along to 
actually submit a patch, but I think this would greatly reduce the 
duplication of code.  This is an issue for me because one of the project 
that I lead, tabletags, also does a lot with building up url's.  Let me 
know if your interested in seeing some of this and I'll post the basic 
API and default implementations of this new urlbuilding functionality.

The other option would be to add this functionality to the existing 
<s:a/> tag.  I'm not sure if this makes sense from an API 
perspective--it may get a little weird if you allow <s:param/> tags to 
be nested within, and also allow the body content of the <s:a/> to be 
the text within the html anchor tag.  From that perspective, a seperate 
<s:actionurl/> tag makes more sense.  It would also depend on how 
similar the ftl templates are and whether the differences are enough to 
warrant a seperate template.
Tom

Joe Germuska wrote:
> There's an open ticket for this issue
>
> https://issues.apache.org/struts/browse/WW-1517
>
> I assigned it to myself, since I, too, am interested in such 
> functionality,
> but I'm looking for some suggestions from someone, anyone with more
> familiarity with the architectural model for the S2 tags because I don't
> quite see how to maximize reuse (because it's essentially a hybrid of the
> <s:a> and <s:url> tags and I'm not sure how to blend them while 
> holding to
> what seems to be the model of a single component object per tag.  
> Maybe we
> could make a completely new component object, but then the question is 
> how
> to not have duplicate code with the Anchor and Url components.
>
> Joe
>
>
> On 2/4/07, Gonçalo Luiz <go...@gmail.com> wrote:
>>
>> Hello,
>>
>> Even though the method I'm using to produce links is working, I think
>> of it like a little bit awkward.
>>
>> An example of what I'm saying is:
>>
>> <a href="<s:url action="preferences_prepare"/>">
>> <s:text name="preferences" />
>> </a>
>>
>>
>> Is there a more "elegant" way of producing links that does not involve
>> this "sub-tag" schema ?
>>
>>
>> Thank you.
>>
>> Best Regards,
>> -- 
>> Gonçalo Luiz
>>
>> ---------------------------------------------------------------------
>> 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: Producing links

Posted by Dave Newton <ne...@yahoo.com>.
--- Joe Germuska <jo...@germuska.com> wrote:
> There's an open ticket for this issue
> https://issues.apache.org/struts/browse/WW-1517
> > <a href="<s:url action="preferences_prepare"/>">
> >   <s:text name="preferences" />
> > </a>

There's obvious base functionality like we're talking
about here (an action or value or href, optional text
from properties, styling, etc.) but <s:a.../> adds a
lot to deal with various AJAXy things.

Are the tag classes twisted enough that it's difficult
to roll the base functionality into <s:url.../> and
add the AJAXy stuff to an <s:a.../> subclass?

The same parameter stuff would be useful in <s:a.../>.

d.



 
____________________________________________________________________________________
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: Producing links

Posted by Joe Germuska <jo...@germuska.com>.
There's an open ticket for this issue

https://issues.apache.org/struts/browse/WW-1517

I assigned it to myself, since I, too, am interested in such functionality,
but I'm looking for some suggestions from someone, anyone with more
familiarity with the architectural model for the S2 tags because I don't
quite see how to maximize reuse (because it's essentially a hybrid of the
<s:a> and <s:url> tags and I'm not sure how to blend them while holding to
what seems to be the model of a single component object per tag.  Maybe we
could make a completely new component object, but then the question is how
to not have duplicate code with the Anchor and Url components.

Joe


On 2/4/07, Gonçalo Luiz <go...@gmail.com> wrote:
>
> Hello,
>
> Even though the method I'm using to produce links is working, I think
> of it like a little bit awkward.
>
> An example of what I'm saying is:
>
> <a href="<s:url action="preferences_prepare"/>">
> <s:text name="preferences" />
> </a>
>
>
> Is there a more "elegant" way of producing links that does not involve
> this "sub-tag" schema ?
>
>
> Thank you.
>
> Best Regards,
> --
> Gonçalo Luiz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Joe Germuska
Joe@Germuska.com * http://blog.germuska.com

"The truth is that we learned from João forever to be out of tune."
-- Caetano Veloso

Re: Producing links

Posted by Dave Newton <ne...@yahoo.com>.
--- Tom Schneider <sc...@gmail.com> wrote:
> I think the idea here is that you'd want to do
> something like:
> 
> <a action="preference_prepare"
>    bundle_key="preferences>
>   <param name="param1" value="value1"/>
> </a>

Yeah, I realized that after I posted.

I should probably have a cooling-off or 5-day waiting
period before I'm allowed to post, really :/

d.



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

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


Re: Producing links

Posted by Tom Schneider <sc...@gmail.com>.
I think the idea here is that you'd want to do something like:

<a action="preference_prepare" bundle_key="preferences>
  <param name="param1" value="value1"/>
</a>

To me, this makes sense because there were many places where I used an 
ww:url tag and a ww:a tag directly after it, so having one tag that 
would handle the functionality of both would be useful.
Tom

Dave Newton wrote:
> --- Gonçalo Luiz <go...@gmail.com> wrote:
>   
>> <a href="<s:url action="preferences_prepare"/>">
>>   <s:text name="preferences" />
>> </a>
>>
>> Is there a more "elegant" way of producing links
>> that does not involve this "sub-tag" schema ?
>>     
>
> Like what? That's how the <a.../> tag works, it has an
> href and the text is the <a.../> body.
>
> If you want to automagicate it write a custom tag, but
> I'm not entirely sure it would be worth it.
>
> d.
>
>
>
>  
> ____________________________________________________________________________________
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.com
>
> ---------------------------------------------------------------------
> 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: Producing links

Posted by Dave Newton <ne...@yahoo.com>.
--- Gonçalo Luiz <go...@gmail.com> wrote:
> <a href="<s:url action="preferences_prepare"/>">
>   <s:text name="preferences" />
> </a>
> 
> Is there a more "elegant" way of producing links
> that does not involve this "sub-tag" schema ?

Like what? That's how the <a.../> tag works, it has an
href and the text is the <a.../> body.

If you want to automagicate it write a custom tag, but
I'm not entirely sure it would be worth it.

d.



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

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