Level: Advanced
Prerequisits: Model, DataControl and Backing-bean class

1. Find the page you need to add the field to i.e. CreateNewEmp.jspx

2. In the body > form of the jsp(x) page you should typically have a “panelForm” where fields are placed on, add a “panelLabelAndMessage” item:

r-click on af:panelForm > Insert inside af:panelForm > PanelLabelAndMessage

3. Then add an “OutputText” item (to display the field):

r-click on af:panelLabelAndMessage > Insert inside af:panelLabelAndMessage > browse… > OutputText

4. Switch to source-view and set a value to the item, to be able to display it:

[javascript]<af:outputText value=”#{uploadSession.empid}”[/javascript]

If you need to save it to a database table you need to add a “Binding” to it:

[javascript]binding=”#{backing_app_CreateNewEmp.empid}”/>[/javascript]
Note: if the binding doesn’t exist inside the backing bean, it will be created (a set and get method).

The full chunk of code (.jspx):

[javascript]<af:panelLabelAndMessage label=”Emp Id”>
<af:outputText value=”#{uploadSession.empid}”
binding=”#{backing_app_CreateNewEmp.empid}”/>
</af:panelLabelAndMessage>[/javascript]

java backing-bean (declaritively created from jsp):

[java]public void setEmpid(CoreOutputText empid) {
this.empid = empid;
}

public CoreOutputText getEmpid() {
return empid;
}[/java]

To make the field hidden from user view, do the same procedure as with OutputText but use InputHidden instead. Note that you shouldn’t just change the code inside the jsp as it will not change the variables created in the backing-bean class. This depends on what you select at first when adding the new field type on the jsp page.