h:commandLink无法正常工作

时间:2015-01-05 15:37:47

标签: jsf jsf-2 commandlink

我在JSF HTML库中创建了一个只有一个<h:commandLink>的简单JSF页面。不幸的是,链接只显示为文本,因此无法点击。

代码:

<!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:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title><ui:insert name="title">Title</ui:insert></title>
    </h:head>

    <h:body>
        <div id="header"></div>

        <h:form id="form">
            <div id="content">
                <h:commandLink action="courseList">Courses</h:commandLink>
            </div>
        </h:form>

        <div id="footer">
            <ui:insert name="footer">
            </ui:insert>
        </div>
    </h:body>

我只是想添加一个简单的链接到“courseList”页面。可能是什么问题?

1 个答案:

答案 0 :(得分:0)

试试这个

<h:commandLink action="courseList" value="Courses"/>