Hi. This new Seam link tag solves a few problems I had. Thanks! There is one 
thing missing from my point of view though. I would like to specify custom urls 
with this tag.

I have been using url rewriting (in and out) to make make friendly URLs for our 
Seam based application. E.g /myfolder/something/ gets rewritten to 
/thing.seam?a=myfolder&b=something.

Would it be possible to add a new attribute to the link tag that enables me to 
override the detected URL? How about 'link' as the attribute. Here is an 
example:

<s:link value="view" link="#{mycomponent.niceUrl}"/>

We would still be able to use all the other attributes. To prove that this 
works I coded a change to your HtmlLink class. Here is the segment prior to my 
change:


  |       String url = 
context.getApplication().getViewHandler().getActionURL(context, viewId);
  |       String encodedUrl = context.getExternalContext().encodeActionURL(url)
  | 

And this is my version:

       String encodedUrl = null;
  |        ValueBinding linkValueBinding = getValueBinding("link");
  |        if (linkValueBinding != null) {
  |            // link from expression
  |           encodedUrl = linkValueBinding.getValue(context).toString();
  |        }
  |        if ((encodedUrl == null) && (link != null)) {
  |             // plain text links
  |            encodedUrl = link;
  |        }
  |        if (encodedUrl == null) {
  |            // just get url from context
  |           String url = 
context.getApplication().getViewHandler().getActionURL(context, viewId);
  |           encodedUrl = context.getExternalContext().encodeActionURL(url);
  |        }

Clearly I had to do all the extra stuff to add in the 'link' attribute to the 
tag.

This change works perfectly for me. There may be a better way to do this and 
I'm not fully up-to-speed on the JSF API. I should probably have encoded the 
URL and there may be other problems...

Anyway, over to you. Is it possible to add in this functionality? Many thanks.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3935861#3935861

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3935861


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to