Getting JSF tag ids to the action class
markadams Dec 7, 2009 10:45 AMGood day,
I have a hibernate File that gets a list of possible reports.
It works fine.
How do I get the selected reportIds from the list and get it to my action.
Here is the code.
Thanks.
error is
@In attribute requires non-null value: ReportHome.report
-------------------Form-------------------
<h:form id="ReportBean">
<h1>Web Reports</h1>
<rich:panel>
<h:panelGrid columns="2">
<h:selectOneMenu id="reportId" value="#{ReportBean.reportId}">
<s:selectItems value="#{reportList.allReports}" var="rep" label="#{rep.reportDescr}"
noSelectionLabel="Please Select..."/>
<s:convertEntity />
</h:selectOneMenu>
</h:panelGrid>
</rich:panel>
<div class="actionButtons">
<s:button id="report" value="Next ->" action="#{ReportHome.getReportParameterPage}"/>
</div>
</h:form>
------------------Action--------------------
@Stateful
@Name("ReportHome")
@Restrict("#{identity.loggedIn}")
public class ReportHomeAction implements ReportHome {
@PersistenceContext
private EntityManager em;
@In(required=true)
@Out(required=true)
private ReportBean report;
@Logger
private Log log;
public String getReportParameterPage() {
int test = report.getReportId();
log.info("<<<< "+test+">>>>>>");
em.flush();
return "/eftCashDropRRParm.xhtml";
}
@Remove
public void destroy() {}
}
------------------Bean--------------------------
@Entity
@Scope(ScopeType.SESSION)
@Name("ReportBean")
public class ReportBean implements Serializable {
private Long id;
private static final long serialVersionUID = 123423423411676L;
@In @Out
private int reportId;
public int getReportId() {
return reportId;
}
public void setReportId(int id) {
this.reportId = id;
}
@Id @GeneratedValue
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
}
------------------------------------------------
I have a hibernate File that gets a list of possible reports.
It works fine.
How do I get the selected reportIds from the list and get it to my action.
Here is the code.
Thanks.
error is
@In attribute requires non-null value: ReportHome.report
-------------------Form-------------------
<h:form id="ReportBean">
<h1>Web Reports</h1>
<rich:panel>
<h:panelGrid columns="2">
<h:selectOneMenu id="reportId" value="#{ReportBean.reportId}">
<s:selectItems value="#{reportList.allReports}" var="rep" label="#{rep.reportDescr}"
noSelectionLabel="Please Select..."/>
<s:convertEntity />
</h:selectOneMenu>
</h:panelGrid>
</rich:panel>
<div class="actionButtons">
<s:button id="report" value="Next ->" action="#{ReportHome.getReportParameterPage}"/>
</div>
</h:form>
------------------Action--------------------
@Stateful
@Name("ReportHome")
@Restrict("#{identity.loggedIn}")
public class ReportHomeAction implements ReportHome {
@PersistenceContext
private EntityManager em;
@In(required=true)
@Out(required=true)
private ReportBean report;
@Logger
private Log log;
public String getReportParameterPage() {
int test = report.getReportId();
log.info("<<<< "+test+">>>>>>");
em.flush();
return "/eftCashDropRRParm.xhtml";
}
@Remove
public void destroy() {}
}
------------------Bean--------------------------
@Entity
@Scope(ScopeType.SESSION)
@Name("ReportBean")
public class ReportBean implements Serializable {
private Long id;
private static final long serialVersionUID = 123423423411676L;
@In @Out
private int reportId;
public int getReportId() {
return reportId;
}
public void setReportId(int id) {
this.reportId = id;
}
@Id @GeneratedValue
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
}
------------------------------------------------