[jboss-user] [JBoss Seam] - Form not submitting using PageFlows
smithbstl
do-not-reply at jboss.com
Wed Apr 11 13:05:03 EDT 2007
I have a weird problem using pageflows. I have a h:commandLink in a datatable that has an action pointing to a transition in a pageflow. When just the action of the commandLink is set, the form never gets submitted and hence my DataModelSelection component is not set. When I throw in an arbitrary actionListener on the commandLink, the form is submitted and all is well. I think I am missing something surely fundamental but can't see it.
When I take out the actionListener, selectedRequest is null, when I put it back in, selectedRequest returns the selected row of the DataModel
Here is the commandLink
<h:commandLink action="viewRequest" actionListener="#{requestEntry.printSelectedRequest}"
| value="#{msgs['ServiceRequestList.viewRequest']}"/>
The pageFlow
<pageflow-definition
| xmlns="http://jboss.com/products/seam/pageflow"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation= "http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-1.2.xsd"
| name="serviceRequestCreation">
|
| <start-page name="addressSearch" view-id="/AddressLookup.xhtml">
| <transition name="viewRequests" to="requestListing"/>
| </start-page>
| <page name="requestListing" view-id="/AddressRequestListing.xhtml">
| <redirect/>
| <transition name="viewRequest" to="serviceRequest"/>
| </page>
| <page name="serviceRequest" view-id="/ServiceRequest.xhtml">
| <redirect/>
| </page>
|
| </pageflow-definition>
Here is the SFSB
@Stateful
| @Name("requestEntry")
| @Scope(ScopeType.CONVERSATION)
| public class RequestEntryAction implements com.stlouiscity.csb.ejb.action.RequestEntry {
|
| @PersistenceContext(unitName="CSB_Oracle", type=PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| @In(create=true)
| private Address address;
|
| @DataModel("addresses")
| private List<ParcelAddress> addresses;
|
| @DataModelSelection(value="addresses")
| @Out(required=false)
| private ParcelAddress selectedAddress;
|
| @DataModel("requests")
| private List<ServiceRequest> requests;
|
| @DataModelSelection(value="requests")
| private ServiceRequest selectedRequest;
|
| public RequestEntryAction() {
| }
|
| public void findAddresses() {
| if (address.getStreetName() != null) {
| System.out.println("Address Is NOT NULL");
| //Find ParcelAddress
| Query q = em.createQuery("Select a From ParcelAddress a Where" +
| " (a.structureAddress.nlc.streetDirection = :streetDirection OR :streetDirection IS NULL) AND" +
| " (lower(a.structureAddress.nlc.streetName) LIKE :street) AND" +
| " (((a.structureAddress.structureAddressPK.houseNumber = :houseNumber) OR" +
| " (:houseNumber BETWEEN a.structureAddress.houseLow AND a.structureAddress.houseHigh)) OR (:houseNumber IS NULL))");
| q.setParameter("houseNumber",address.getHouseNumber());
| q.setParameter("streetDirection",address.getStreetDirection());
| q.setParameter("street",address.getStreetName().toLowerCase() + "%");
| addresses = q.getResultList();
| } else {
| System.out.println("Address IS NULL");
| }
| }
|
| public void viewRequests() {
| System.out.println("**********Started PageFlow*************");
| findRequests(selectedAddress);
| }
|
| public void findRequests(ParcelAddress address) {
| System.out.println("**********Entered findRequests*************");
| System.out.println("**********Selected Address: " + address.toString());
| Query q = em.createQuery("Select s From ServiceRequest s Where" +
| " s.parcelAddress.parcelAddressPK.houseNumber = :houseNumber AND" +
| " s.parcelAddress.parcelAddressPK.houseSuffix = :houseSuffix AND" +
| " s.parcelAddress.parcelAddressPK.nlc = :nlc AND" +
| " s.parcelAddress.parcelAddressPK.cityBlock = :cityBlock AND" +
| " s.parcelAddress.parcelAddressPK.parcelNumber = :parcelNumber)");
| q.setParameter("houseNumber", address.getParcelAddressPK().getHouseNumber());
| q.setParameter("houseSuffix", address.getParcelAddressPK().getHouseSuffix());
| q.setParameter("nlc", address.getParcelAddressPK().getNlc());
| q.setParameter("cityBlock", address.getParcelAddressPK().getCityBlock());
| q.setParameter("parcelNumber", address.getParcelAddressPK().getParcelNumber());
| requests = q.getResultList();
| }
| }
|
| public void printSelectedRequest() {
| System.out.println("Selected Request: " + getSelectedRequest().toString());
| }
|
| @Remove @Destroy
| public void destroy() {
|
| }
|
| public ServiceRequest getSelectedRequest() {
| return selectedRequest;
| }
|
| public void setSelectedRequest(ServiceRequest selectedRequest) {
| this.selectedRequest = selectedRequest;
| }
|
TIA
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036454#4036454
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036454
More information about the jboss-user
mailing list