Be aware that <h:ouptutLink> doesn't get the URL automatically from the ViewHandler as does <h:commandLink>, which means you have to put the servlet context root in the URL (of course, you can create a managed bean getter to get it and insert the expression in your URL). In addition, <h:outputLInk> will give you trouble in a portal environment, whereas <h:commandLink> works because a custom ViewHandlerImpl handles the portal URL translation for you.
I agree that requiring JS is a big limitation of JSF; however, I don't see a way around for <h:commandLink>, either. /dmc David Chandler http://learnjsf.com On 10/21/06, Gary VanMatre <[EMAIL PROTECTED]> wrote:
>From: "Craig McClanahan" <[EMAIL PROTECTED]> > > On 10/20/06, Chad Boyd wrote: > > > > I have a general JSF question about hyperlinks. I know this is more of > > a mailing list for Shale, but in looking into using Shale at my company > > I came upon this question that I thought someone on this list might be > > able to answer. > > > > >From what I can tell, there is no way to generate a hyperlink that is > > linked to a "ViewController component" in JSF that doesn't use > > JavaScript. It seems like when I look at the output source from sample > > faces applications, the links always use the onclick JavaScript handler > > to navigate to the next view. Is it not possible to render a link > > without relying on JavaScript to do the browser navigation? I can see > > this being a potential problem when trying to build a internet-facing > > application in which you don't have control over the user's environment. > > What if they have JavaScript turned off in the browser? The whole > > website would not work then? I think that is a major limitation of JSF. > > If I've overlooked something here, please let me know. I look forward > > to anyone's comments. > > > Your analysis is correct ... the component is the only > standard JSF component that requires JavaScript. However, this was not done > with any particular desire to require JavaScript -- indeed, as far as the > JSF expert group could determine, there was no HTML solution to this problem > that did *not* require JavaScript to be enabled. If we were wrong, > ***please*** show us how you can have a hyperlink submit a form when > JavaScript is disabled! Alas, I don't see such a solution as being possible > with the current generation of browsers, or the current formal W3C > definition of HTML or XHTML. > There is still the option of using the standard "outputLink" control and then hook in to the prerender() callback of the view controller. This performs a GET request so all state must be loaded as query parameters on the anchored link. <h:ouputLink value="http://myotherapp"/> <f:param name="key" value="#{mbean.someKey}"/> </h:outputLink> public prerender() { Map params = (Map) getBean("param"); String someKey = (String) param.get("param"); } > Craig
-- http://learnjsf.com
