Skip to main content

JSF 2.0 condtional rendering problem - malformedURL

2 replies [Last post]
dmakarijevic
Offline
Joined: 2011-02-02
Points: 0

Hi all,
A very simple JSF: using a commandLink and ajax I am trying trying to re-render an output text "msg1". However I get browser error "MalformedURL During update ...msg1 not found"

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>

<h:head>
<title>My Title</title>
</h:head>
<h:body>
<h:form name="f1">
<h:commandLink action="#{loginBacking.setIt}">Menu1
<f:ajax render="msg1"/>
</h:commandLink>

<h:outputText id="msg1" value="AAAAAAAAAA" rendered="#{loginBacking.forums}" />
</h:form>
</h:body>
</html>

loginBacking class:
...
private boolean forums; //PLUS isForums() and setForums() methods
public void setIt() {
this.forums = !this.forums;
}
NOTE: if I change rendered="#{loginBacking.forums}" to rendered="true" it doesn't give me that error, but that's not what I want.

Thanks in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexoulew
Offline
Joined: 2010-12-29
Points: 0

try something like this:
<h:panelGroup id="msg1">
<h:outputText value="AAAAAAAAAA" rendered="#{loginBacking.forums}" />
</h:panelGroup>

I think As your outputText is not rendered, it cannot be found on client side and cannot be updated.

dmakarijevic
Offline
Joined: 2011-02-02
Points: 0

Thank you alexoulew, you are right.