0
JSF代码我怎样才能把从servlet的(了request.setAttribute( “studentProfile”,allProfile))数据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>`
的Servlet
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?
JSP背后的关键思想是它有一个BackingBean http://docs.oracle.com/javaee/5/tutorial/doc/bnaqm.html –
请学习JSF,这已在基础知识中介绍过。 [StackOverflow JSF wiki](http://stackoverflow.com/tags/jsf/info)有很好的资源。 –
@ user2310289这些资源用于旧的JSF 1.2。请注意,自从[2013年10月3日](https://javaserverfaces.java.net/)以来,JSF已经在JSF 1.2和JSF 2.0之间改变了很多**,并且目前在JSF 2.2.4中。 –