JSF 代码
<h:dataTable value="#{requestScope.allProfile}" var="allProfile">
<h:column>
<f:facet name="header">StudentID</f:facet>
<h:inputText value="#{allProfile.studentId}"
size="10" rendered="#{allProfile.canEdit}" />
<h:outputText value="#{allProfile.studentId}"
rendered="#{not allProfile.canEdit}" />
</h:column>`
小服务程序
private void doProcess(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException, Exception {
StudentManager stuManager = new StudentManager();
List<studto>allProfile = stuManager.getAllstudentProfile();
request.setAttribute("studentProfile", allProfile);
RequestDispatcher rd = request.getRequestDispatcher("/ViewPage.xhtml");
rd.forward(request, response);
}
我已经能够从数据库中获取我的数据,直到 servlet。但我无法在 xhtml 页面中获取数据。我是否需要创建 faces-config 来编写托管 bean?