You'll just want to be careful, that won't always be the case. It depends on the bridge and Portal implementation. I'm not sure such a thing would work, for instance, on WebSphere or Pluto..

scott

Alexander Wallace wrote:
Thank you very much... It does make sense...

However, i just discovered that my developer was making a mistake and passing the piece of text that had the # as a parameter to the outputUrl tag, which as it should be expected, would get encoded...

I hear what you are saying, and it must be that way according to standards, but i can tell you that using Liferay 4.3.1 and MyFaces 1.1.4, i can do this:

                                <h:outputLink value="#{result.url}">
<h:outputText value="go to another page and focus on a particular portlet "/>
                                </h:outputLink>

the #{result.url} returns a url to a different page (not where the current portlet is at) and at the end it as #p_MyPortletInstanceId

And it works... So... Maybe i didn't explain what I was attempting and it falls outside of your tech explanation, or one of these two pieces of software don't fully follow the standard...

In any event, you made me actually look at what was happening and illustrated me about the standard... and i now have what i need... so, receive my sincere thanks for your time and help!

On Nov 30, 2007, at 12:08 PM, Scott O'Bryan wrote:

:)  Technical information time.

A JSR-168 portal environment does not allow you to construct "ActionURL's" with bookmark information inside. It's impossible because the URL is generated by the Portal and there is no API to allow adding bookmark data. Furthermore, modifying an actionURL after it's generated is forbidden by the Portal specification.

JSF has an encodeActionURL method for which it takes servlet-like page references and tasks the bridge with somehow creating a real life portal compatible url with it. The thing is, though, the ultimately faces is at the mercy of the underlying implementation. So the encodeActionURL cannot correctly translate urls that have bookmark references. In order to allow JSF documents to work in both environments JSF components need to encode the action url or else a reference to another JSF page would not continue to be displayed in the portal because of the nature of the portal architecture. Therefore adding a URL via a JSF component, you must undergo this encoding process for things to work correctly. When you write an anchor tag inside of a verbatum, neither the portal NOR faces touches that URL. This is why it works. But if you were to put a reference to a Faces page inside of that anchor tag, you would likely get your faces application displayed OUTSIDE of the portal altogether. From a Faces standpoint, it is much better to allow these resources to stay in-container rather then support artifacts like bookmarks especially considering the bookmarks are not present on all portal containers.

Does that make sense?

Scott

Alexander Wallace wrote:
but if it is the portal, then it is only when it deals with JSF, cuz if i put stuff outside of the jsf view, or inside of a <f:verbatim> block, the anchor works just fine... Is that what you mean?

On Nov 29, 2007, at 6:00 PM, Scott O'Bryan wrote:

More to the point, the PORTAL will change the #, not JSF. If you're interested in a technical explanation let me know. :)

Scott

Alexander Wallace wrote:
I guess you are saying that JSF will change the # into something... If i use a link out of JSF the anchor works fine... I'll see about using verbatim or something around those lines then...

thanks!

On Nov 29, 2007, at 1:29 PM, Scott O'Bryan wrote:

Alex,

Yeah, that's not going to work. In the servlet case, what you are proposing does just fine, but in the portlet case, encoded url's actually turn into something entirely different and the bookmark (#) notation is not something that is supported by JSR168. I would look at having your portlet use javascript to set focus on your portlet or recommend that people put fewer portlets on the screen at any given time.

:)  Scott

Alexander Wallace wrote:
Hi!

I'm developing portlets and the portal allows me to position the screen on a particular portlet using anchors... Like #p_my_particular_portlet ....

I have a portlet with links to other pages and I want to use the anchors to give focus to my_particular_portlet

When i do this in an outputLink in my faces ie: /my_page#p_my_particular_portlet, myfaces turns the # into the html entity and the anchor is thusly broken... It won't give focus to my portlet... I've tried entering the html entity even but then an entity for the % is added too... So that doesn't work...

Has anyone been able to succesfully use # in urls in outputLinks? (i'm using myfaces 1.1.4 btw)

Thanks!















Reply via email to