English 中文(简体)
缩略语 1Menu(原始面孔)
原标题:JSF page doesnot work when i add selectOneMenu (prime faces)

i 有一名有管理的美籍讲师。 讲演人管理的神职人员包括各部之间的关系。 我愿向数据库中储存的所有部门介绍情况。 当一名讲师注册时,需要找到自己的部门。

我的讲师管理了神父。 i 具备适当的固定装置和接力方法。 i 仅略作澄清。

public class Lecturer 
{

    private String name;
    private String surname;

    private String email;
    private String username;
    private String password;


    private List<Department> departments;

    private LecturerService lecturerService;
    private DepartmentService departmentService;
}

我的李克里。 xhtml file:

<h:form>
<f:view>
<p:panelGrid columns="2">  

<f:facet name="header">Lecturer Registration Form</f:facet> 

<h:outputLabel for="name" value="Name :" />  
<p:inputText id="name" value="#{Lecturer.name}" label="Name" required="true" />

<h:outputLabel for="surname" value="Surname :" />  
<p:inputText id="surname" value="#{Lecturer.surname}" label="Surname" required="true" />

<h:outputLabel for="department" value="Department :" /> 


<p:selectOneMenu value="#{Lecturer.departments}" effect="fade" editable="true" var="p" >
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{Lecturer.departments}" var="lec"
itemLabel="#{lec.name}" itemValue="#{lec.name}"/>
</p:selectOneMenu>


<h:outputLabel for="email" value="Email :" />  
<p:inputText id="email" value="#{Lecturer.email}" label="Email" required="true" />

<h:outputLabel for="username" value="User Name :" />  
<p:inputText id="username" value="#{Lecturer.username}" label="Email" required="true" />

<h:outputLabel for="password" value="Password :" />  
<p:inputText id="password" value="#{Lecturer.password}" label="Password" required="true" />

<f:facet name="footer">

 <p:commandButton type="submit"
                id="lecturer"
                action="#{Lecturer.registerLecturer}"
                value="Register" icon="ui-icon-disk">

                </p:commandButton>

</f:facet>

</p:panelGrid>
</f:view>
</h:form>

我的脸谱。

<managed-bean>
        <managed-bean-name>Lecturer</managed-bean-name>
        <managed-bean-class>com.studinfo.controller.Lecturer</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>

        <managed-property>
            <property-name>departmentService</property-name>
            <property-class>com.studinfo.services.DepartmentService</property-class>
            <value>#{DepartmentService}</value>
        </managed-property>

        <managed-property>
            <property-name>lecturerService</property-name>
            <property-class>com.studinfo.services.LecturerService</property-class>
            <value>#{LecturerService}</value>
        </managed-property>
    </managed-bean>

一、删除选择 A. 1Menu tag。 我的网页运转良好。

对解决办法的任何想法?

是否有必要在扼杀和部门之间增加变换者?

最佳回答

。 您需要为此在您的赞助中增加一个领域,例如:

private Department selectedDepartment
// getter and setter

接着在您的面目中改动了<代码>p:select OneMenu和:selectItems:

<p:selectOneMenu value="#{Lecturer.selectedDepartment}" effect="fade" 
                 editable="true" var="p" >
  <f:selectItem itemLabel="Select One" itemValue="" />
  <f:selectItems value="#{Lecturer.departments}" var="lec"
                 itemLabel="#{lec.name}" itemValue="#{lec}"/>
</p:selectOneMenu>

此外,你们还需要一名转换者,以绘制选定的插图,用于物体。

问题回答

暂无回答




相关问题
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 ...

热门标签