我是 JSF 的新手,我尝试用谷歌搜索并查看 BalusC 的示例,但失败了。我现在有一个数据表,它可以工作,但我想要实现的是,当你点击一行时,我当然想在 bean 中存储一些信息,然后打开一个新页面,我可以在其中显示更多细节关于被点击的行。这是我的代码:
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
Degree:
<div class="degreeProgram">
<h:selectOneMenu onchange="submit()" valueChangeListener="#{course.degreeProgramChanged}">
<f:selectItems value="#{course.programs}" />
</h:selectOneMenu>
</div>
Major:
<div class="major">
<h:selectOneMenu onchange ="submit()" valueChangeListener="#{course.majorChanged}">
<f:selectItems value="#{course.majors}" />
</h:selectOneMenu>
</div>
Identifier:
<h:inputText value="#{course.identifier}"></h:inputText>
Course coordinator:
<div class="major">
<h:selectOneMenu onchange ="submit()" valueChangeListener="#{course.coordinatorChanged}">
<f:selectItems value="#{course.coordinators}" />
</h:selectOneMenu>
</div>
</h:panelGrid>
</h:form>
<b>Course Offering:</b>
<br></br>
<h:form>
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
Section:
<div class="degreeProgram">
<h:inputText value="#{course.section}"></h:inputText>
</div>
Semester
<div class="major">
<h:inputText value="#{course.semester}"></h:inputText>
</div>
Instructors:
<div class="major">
<h:selectOneMenu onchange ="submit()" valueChangeListener="#{course.coordinatorChanged}">
<f:selectItems value="#{course.instructors}" />
</h:selectOneMenu>
</div>
<h:commandButton value="submit" action="#{course.executeSearch()}"></h:commandButton>
</h:panelGrid>
</h:form>