so I tried @RequestParameter with pages.xml config and failed (value was not
coming thru, so it was null).
now I'm trying the "regular" JSF way per pg. 292 of the Geary/horstmann 2nd
edition.
Anything wrong with the following code? this doesn't work either (I'm viewing
the params object values in the eclipse debugger and it's null):
<h:form id="mainForm">
| <h:outputText value="No Direct Reports"
rendered="#{myAuditList != null and myAuditList.rowCount==0}"/>
| <h:dataTable id="dataTable1"
value="#{myAuditList}" var="myRow" rendered="#{myAuditList != null and
myAuditList.rowCount > 0}"
| styleClass="dataTable"
rowClasses="oddRow, evenRow" frame="hsides">
|
| <h:column>
| <f:facet name="header">Employee
Name</f:facet>
|
| <!-- siteId and employeeNumber hidden
fields are used for all radio buttons -->
| <h:outputText id="employeeName"
value="#{myRow[0].id.employeeName}"/>
| <h:inputHidden id="employeeNameHidden"
value="#{myRow[0].id.employeeName}"/>
| <h:inputHidden id="siteId"
value="#{myRow[0].id.siteId}"/>
| <h:inputHidden id="employeeNumber"
value="#{myRow[0].id.employeeNumber}"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">SiteId</f:facet>
|
| <h:outputText
value="#{myRow[0].id.siteId}"/>
| </h:column>
|
| <h:column>
| <f:facet
name="header">EmployeeNumber</f:facet>
|
| <h:outputText
value="#{myRow[0].id.employeeNumber}"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">Account
Approved?</f:facet>
|
| <h:selectOneRadio
id="accountApprovedRB" value="#{myRow[1].icomsAccountApproved}"
onclick="processNote(this, #{myAuditList.getRowIndex()},
'accountApproved');checkForSubmit(#{myAuditList.getRowIndex()})">
| <f:selectItems
value="#{securityAuditAction.securityAuditRadioButtons}" />
| </h:selectOneRadio>
| <h:graphicImage
id="acctGraphic" value="/img/icon_edit.gif"
onclick="editNote(#{myAuditList.getRowIndex()}, 'accountApproved');"
style="visibility:hidden"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">Security Level
Approved?</f:facet>
| <h:selectOneRadio
id="securityLevelApprovedRB" value="#{myRow[1].securityLevelApproved}"
onclick="processNote(this, #{myAuditList.getRowIndex()},
'secLevelApproved');checkForSubmit(#{myAuditList.getRowIndex()})">
| <f:selectItems
value="#{securityAuditAction.securityAuditRadioButtons}" />
| </h:selectOneRadio>
| <h:graphicImage
id="securityLevelGraphic" value="/img/icon_edit.gif"
onclick="editNote(#{myAuditList.getRowIndex()}, 'secLevelApproved');"
style="visibility:hidden"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">Adjustment Limit
Approved?</f:facet>
| <h:selectOneRadio
id="adjustmentLimitApprovedRB" value="#{myRow[1].adjustmentLimitApproved}"
onclick="processNote(this, #{myAuditList.getRowIndex()},
'adjLimitApproved');checkForSubmit(#{myAuditList.getRowIndex()})">
| <f:selectItems
value="#{securityAuditAction.securityAuditRadioButtons}" />
| </h:selectOneRadio>
| <h:graphicImage
id="adjLimitGraphic" value="/img/icon_edit.gif"
onclick="editNote(#{myAuditList.getRowIndex()}, 'adjLimitApproved');"
style="visibility:hidden"/>
| </h:column>
|
| <h:column>
| <h:commandButton id="submitEmployee"
value="Submit" action="#{securityAuditAction.submit}" style="visibility:hidden">
| <f:param
name="securityAuditRowNum" value="#{myAuditList.getRowIndex()}"/>
| </h:commandButton>
| </h:column>
| </h:dataTable>
|
| </h:form>
SFSB:
public void submit() {
|
| //check to see if there are any notes for each radio button for
this emploee/row
| //then upddate/insert accordingly
|
| //TO DO: use @RequestParameter injection instead of
facescontext...
| FacesContext context = FacesContext.getCurrentInstance();
| Map<String, String> params =
context.getExternalContext().getRequestParameterMap();
| int rowNum =
Integer.parseInt(params.get("securityAuditRowNum")==null?"":params.get("securityAuditRowNum"));
|
| for (int i = 0; i < 3; i++) {
| TblSecurityAuditNote note = myNotes[rowNum];
| if (note != null) {
| log.info("myNotes["+rowNum+"]["+i+"]: noteText
= " + note.getNoteText());
| //em.persist(myNotes[rowNum]);
| }
| }
| }
seems to me this should be very straightforward... I even hard-coded the value
like:
<f:param name="securityAuditRowNum" value="bigmomma"/>
value for params map was null in debugger variables...
do you HAVE to set some config code in the pages.xml? if so, the book didn't
mention anything about that as far as managed bean JSF configurations for
request params passing...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101010#4101010
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101010
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user