views:

56

answers:

2

My problem is that when I for example do this

<h:outputLink value="changeinfo.jsf">
                Change name
                <f:param name="change" value="name"/>
</h:outputLink>

then the requested url is

http://localhost:45054/WMC/user/changeinfo.jsf?change=name

My url pattern for the faces servlet look like this

<servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
 </servlet-mapping>

Now on the changeinfo page

<f:verbatim rendered="#{'bean.param'} == 'name'"> 
NAME 
<h:form id="form1"> 
... 
</h:form>
</f:verbatim>

Then on the generated html page I only see the word NAME and not the form. Why is this?

A: 

Have you seen this: How to create a GET request with parameters, using JSF and navigation-rules?

The problem is not the extension, but that JSF doesn't support this approach out of the box. If you have to code the McDowell solution or change web framework using for example Seam.

BTW, JSF 2 will support this style of navigation. Take a look at: fluent-navigation-jsf-2

volothamp
+2  A: 

You can't put JSF components inside a f:verbatim, only plain vanilla HTML. Use h:panelGroup instead.

Also, get rid of those quotes around the bean property identifier in EL. It would otherwise be treated as a plain vanilla string. You should also put the string comparison inside the EL expression.

Summarized:

<h:panelGroup rendered="#{bean.param == 'name'}">
    ...
</h:panelGroup>

As an extra hint: you can just access request parameters by #{param}. If you don't need it further in the managed bean, then you can also just do so:

<h:panelGroup rendered="#{param.change == 'name'}">
    ...
</h:panelGroup>
BalusC
Darn you BalusC! Always answering JSF questions before I get to! ;P
Drew