-
1. Re: using commandButton to link to a new window (xhtml)
max522over Apr 11, 2006 10:17 AM (in response to kittyk)In code set up the listing behavior with:
@DataModel
private List locationList;
@DataModelSelection
private Location selectedLocation;
your jsp code could look like: I'm not sure about xhtml
<h:dataTable value="#{locationList}" var="location" rendered="#{locationList.rowCount>0}"
rowClasses="rvgRowOne,rvgRowTwo" headerClass="rvgOrder">
<h:column>
<f:facet name="header">
<h:commandLink value="#{msg.Location_id}" action="#{locationFinder.reorder}">
<f:param name="orderBy" value="id"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{location.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="#{msg.Location_street}" action="#{locationFinder.reorder}">
<f:param name="orderBy" value="street"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{location.street}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="#{msg.Location_city}" action="#{locationFinder.reorder}">
<f:param name="orderBy" value="city"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{location.city}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="#{msg.Location_state}" action="#{locationFinder.reorder}">
<f:param name="orderBy" value="state"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{location.state}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="#{msg.Location_zip}" action="#{locationFinder.reorder}">
<f:param name="orderBy" value="zip"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{location.zip}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="#{msg.Location_opentime}" action="#{locationFinder.reorder}">
<f:param name="orderBy" value="opentime"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{location.opentime}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:commandLink value="#{msg.Location_closetime}" action="#{locationFinder.reorder}">
<f:param name="orderBy" value="closetime"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{location.closetime}"/>
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="#{msg.Action}"/></f:facet>
<h:commandButton action="#{locationSelector.select}" value="#{locationSelector.buttonLabel}"/>
</h:column>
</h:dataTable>
then in your method locationSelector.select:
public String select() {
locationEditor.setInstance(locationFinder.getSelection());
locationEditor.setNew(false);
return "editLocation";
}
the editLocation string return will be used by the page flow to identfy the page to display: Here is an example from the faces-config.xml file
<!-- navigation rules for com.devx.res.example.Location -->
<navigation-rule>
<navigation-case>
<from-outcome>editLocation</from-outcome>
<to-view-id>/editLocation.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>selectLocation</from-outcome>
<to-view-id>/findLocation.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>findLocation</from-outcome>
<to-view-id>/findLocation.jsp</to-view-id>
</navigation-case>
</navigation-rule> -
2. Re: using commandButton to link to a new window (xhtml)
max522over Apr 11, 2006 10:31 AM (in response to kittyk)@DataModel private List<Location> locationList; @DataModelSelection private Location selectedLocation;
I needed to quote the"<location>"
with code quotes for you to see it. -
3. Re: using commandButton to link to a new window (xhtml)
chane Apr 11, 2006 3:27 PM (in response to kittyk)The booking demo has an example of this.
Also discussed in this thread.
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=80815
Good luck!
Chris.... -
4. Re: using commandButton to link to a new window (xhtml)
kittyk Apr 11, 2006 6:07 PM (in response to kittyk)Thanks heaps!!! :)