Hi! I need to render some text containing links i a JSF component. I cannot render a full commandLink element, since the data comes from a content management system and the contract allows me to only modify the href attribute of the anker element. The whole thing runs under Liferay, a portlet container.
The solution I came up with is: - declare a outputText element in the jsp and use its binding attribute to create my own UIComponent. - my UIComponent renders its children (getRendersChildren returns true) - override encodeChildren and output the text while modifying the href attribute of the href tokens. I can click the link in the rendered page but the lifecycle gets somehow distorted, because the viewrott is not restored properly, i.e. The RestoreViewExecutor cannot restore the view. T he result is that the lifecycle is interrupted and the request doesn't get through to the "Invoke Application" phase. Here is how I create the action link: ( the code is mostly copied from org.apache.myfaces.shared_impl.renderkit.html.HtmlLinkRenderBase String viewId = "/article/article.jsp"; if (PortletUtil.isRenderResponse(context)) { RenderResponse response = (RenderResponse)context.getExternalContext().getResponse(); PortletURL url = response.createActionURL(); url.setParameter(MyFacesGenericPortlet.VIEW_ID, viewId); url.setParameter(PARAM_ITEMID, hrefToken.getLinkData()); url.setParameter(PARAM_ITEMTYPE, hrefToken.getLinkType().toString()); return url.toString() + '#'; } Is there a better way of generating an action url. This implementation has a hard-coded navigation and is so ugly. There must be a better way. Any ideas are much appreciated. Cheers Martin