[jboss-user] [JBoss Seam] - Re: Seam 2 breaks all-on-one-page application

damianharvey do-not-reply at jboss.com
Mon Oct 15 14:25:23 EDT 2007


Sure thing.

I have an MaintainVessels.xhtml page like this:
  | <h:form>
  | <!--  Vessel name -->
  | <s:decorate id="validateName" template="/layout/edit.xhtml">
  | 	<ui:define name="label">#{messages['vessels.vesselName']}</ui:define>
  | 	<h:inputText tabindex="1" styleClass="inputField" id="vesselName" value="#{vesselHome.instance.vesselName}" required="true" size="40" maxlength="150">
  | 		<a:support event="onchange" reRender="validateName"/>
  | 	</h:inputText>
  | </s:decorate>
  | other fields....
  | <h:commandButton value="#{messages['saveButton']}" styleClass="button" action="#{vesselHome.persist}" rendered="#{!vesselHome.managed}"/>
  | </h:form>
  | <h:form>
  | <rich:dataTable styleClass="dataTable" id="vesselTable" value="#{vesselList.allVessels}" var="vesselEntry" rows="20">
  | 	<rich:column>
  | 		<f:facet name="header">#{messages['vessels.carrier']}</f:facet>
  | 		<h:outputText value="#{vesselEntry.company.companyName}"/>
  | 	</rich:column>
  | more columns....
  | 	<rich:column>
  | 		<s:link action="#{vesselHome.find}"
  | 			title="#{messages['edit.entry']}">
  | 			<f:param name="vesselVesselId" value="#{vesselEntry.vesselId}"/>
  | 			<h:graphicImage url="/img/edit.png" border="0"/>
  | 		</s:link>
  | 		<s:link action="#{vesselHome.remove}"
  | 			onclick="return confirm('#{messages['confirm.deleteEntry']}');"
  | 			title="#{messages['delete.entry']}">
  | 			<f:param name="vesselVesselId" value="#{vesselEntry.vesselId}"/>
  | 			<h:graphicImage url="/img/cross.png" border="0"/>
  | 		</s:link>
  | 	</rich:column>
  | </rich:dataTable>
  | </h:form>
  | 

And my VesselHome persist method looks like this:
  | @Override
  | @Transactional
  | public String persist() {
  | 
  | 	//Set status to active
  | 	getInstance().setStatus(VesselStatus.ACTIVE);
  | 
  | 	String status = super.persist();
  | 
  | 	//Remove from Conversation context
  | 	Contexts.removeFromAllContexts("vesselHome");
  | 
  | 	return status;
  | }
  | 

The MaintainVessels.page.xml has the following rules:
  | <?xml version="1.0" encoding="UTF-8"?>
  | <page xmlns="http://jboss.com/products/seam/pages"
  |       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |       xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd" login-required="true">
  | 	<begin-conversation join="true"/>
  | 	<restrict>#{s:hasRole('VESSEL EDITOR') or s:hasRole('VESSEL APPROVER')}</restrict>
  | 	<param name="vesselVesselId" value="#{vesselHome.vesselVesselId}"/>
  | 	<navigation from-action="#{vesselHome.persist}">
  | 		 <redirect view-id="/secure/MaintainVessels.xhtml"/>
  | 	</navigation>
  | 	<navigation from-action="#{vesselHome.update}">
  | 		 <redirect view-id="/secure/MaintainVessels.xhtml"/>
  | 	</navigation>
  | 	<navigation from-action="#{vesselHome.remove}">
  | 		 <redirect view-id="/secure/MaintainVessels.xhtml"/>
  | 	</navigation>
  | 	<navigation from-action="#{vesselHome.reset}">
  | 		 <redirect view-id="/secure/MaintainVessels.xhtml"/>
  | 	</navigation>
  | 
  | </page>
  |  

Under Seam 1.2.1.GA I could fill in the values for a new Vessel and click save. This would call the persist() method. Once that had finished the page.xml would redirect it back to the MaintainVessels page and the values in the fields would be blank as no VesselHome existed in the context.

This doesn't happen under Seam 2.0.0.CR2. When I click save, the instance is persisted and the page is redirected fine, but the values exist. 

I've tried adding an <end-conversation/> to the MaintainVessel.page.xml but this will only work if I redirect to another page and not back to the same page.

Cheers,

Damian.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095363#4095363

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095363



More information about the jboss-user mailing list