English 中文(简体)
使用JSF进行页面导航
原标题:Page navigation with JSF

也许这是一个简单的问题,但我不知道答案。

我有一个项目,我的项目。在webContent中,我有home.xhtml、leave.html文件,还有另外两个文件夹:cats和dogs。在cats目录中,我有一个页面cat.xhtml,在目录dogs中,我还有一个页面dogs.xhtml。

I want to go from each page (home,cats, dogs) to page leave.html In each file there is a commandLink

<h:form>
    <h:outputLink value="leave.html" action="#{myBean.leave}">
        <f:verbatim>Leave</f:verbatim>
    </h:outputLink>
</h:form>

myBean在方法leave中返回字符串“leave”

<navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
        <from-outcome>leave</from-outcome>
        <to-view-id>/leave.html</to-view-id>
    </navigation-case>
</navigation-rule>

But this doesn t work. I also tried using <to-view-id>../leave.html</to-view-id> or add a new folder leave and put in there the leave.html page. I used <to-view-id>/leave/leave.html</to-view-id> or <to-view-id>/../leave.html</to-view-id>

but all have the same result HTTP Status 404 /myProject/cats/leave.htlm type Status report

消息/myProject/cats/leave.htlm

description The requested resource ( /myProject/cats/leave.htlm) is not available.

问题回答

Your navigation is not working because page is always going to "leave.html". h:outpuLink uses value property for navigation. I suggest you use h:commandLink and use value property for display link (Leave) and action property for from-outcome string.

<h:commandLink value="Leave" action="#{myBean.leave}"> 




相关问题
JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

如何拦截要求终止?

在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

ICEFaces inputFile getting the file content without upload

Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

热门标签