Java Reference
In-Depth Information
Managed bean for the section JSF page
In the managed bean class
view.backing.Section
, add a method
getAllEditions()
to retrieve all the
Edition
entities, retrieve the
Edition
entity
ids
, and create a parameterized
ArrayList
of type
SelectItem
, which has a value
binding with the
Menu
component for the
Edition
Id
label in the
section.jsp
JSF
page, from the
Edition
ids
.
In the
commandButton1_action
method, retrieve the values for the
Section
id
,
Section
name
, and
Edition
id
with the procedure discussed for the
view.backing.
Article
managed bean class. Create an
InitialContext
object and lookup the
session bean with its remote interface, and create and persist a
Section
entity object.
The
view.backing.Section
class is listed as follows:
package view.backing;
import model.*;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
import javax.faces.component.UISelectItems;
import javax.faces.component.html.HtmlCommandButton;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlOutputFormat;
import javax.faces.component.html.HtmlOutputLabel;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.component.html.HtmlSelectOneMenu;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class Section {
private HtmlForm form1;
private HtmlOutputFormat outputFormat1;
private HtmlPanelGrid panelGrid1;
private HtmlOutputLabel outputLabel1;
private HtmlInputText inputText1;
private HtmlOutputLabel outputLabel2;
private HtmlInputText inputText2;
private HtmlOutputLabel outputLabel3;
private HtmlSelectOneMenu selectOneMenu1;
private UISelectItems selectItems1;
private HtmlCommandButton commandButton1;
private ArrayList<SelectItem> editionItems;
private String editionItem;
public Section() {
getAllEditions();
}
Search WWH ::
Custom Search