[jboss-user] [JBoss Seam] - Value won't change

ector7280 do-not-reply at jboss.com
Tue May 15 13:59:58 EDT 2007


First let me explain what I trying to do.
I'm using Seam 1.2 with Ajax4JSF and I'm trying to change the value of a selectOneMenu by using ajax on a selectOneRadio.
The problem is that the value sent back never changes even as the value on the page is changed.  Do you have to submit the page to get the value to change?

Here's the relevant code:

 
  | <f:view xmlns="http://www.w3.org/1999/xhtml"
  | 	xmlns:s="http://jboss.com/products/seam/taglib"
  | 	xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	xmlns:f="http://java.sun.com/jsf/core"
  | 	xmlns:h="http://java.sun.com/jsf/html"
  | 	xmlns:tr="http://myfaces.apache.org/trinidad"
  | 	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
  | 	xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
  | 
  | 	<html>
  | 	<body>
  | 
  | 	<h:messages globalOnly="true" styleClass="message" id="globalMessages" />
  | 	<h:form id="vessel" styleClass="edit">
  | 
  | 		<rich:panel>
  | 			<f:facet name="header">Vessel Details</f:facet>
  | 
  | 			<s:decorate id="vesselIdDecoration">
  | 				<h:inputHidden id="vesselId" disabled="#{vesselHome.managed}"
  | 					value="#{vesselHome.instance.vesselId}">
  | 					<a4j:support event="onblur" reRender="vesselIdDecoration" />
  | 				</h:inputHidden>
  | 			</s:decorate>
  | 			<h:outputText>
  | 				<fieldset title="shipyard"><legend>Shipyard</legend> <a4j:outputPanel
  | 					ajaxRendered="true">
  | 					<h:panelGrid columns="2" rowClasses="prop"
  | 						columnClasses="name,value" title="Shipyard Info">
  | 						<h:outputLabel for="statusDecoration">
  | 							<p align="right"><span class="required">*</span> Shipyard
  | 							Status:</p>
  | 						</h:outputLabel>
  | 						<s:decorate id="statusDecoration">
  | 							<h:selectOneRadio id="status" value="#{shipyardFilter.statusId}"
  | 								styleClass="radio">
  | 								<a4j:support event="onclick" reRender="status,shipyard, location1" />
  | 								<f:selectItem itemLabel="Open" itemValue="1" />
  | 								<f:selectItem itemLabel="Closed" itemValue="2" />
  | 								<f:selectItem itemLabel="Renamed" itemValue="3" />
  | 								
  | 							</h:selectOneRadio>
  | 						</s:decorate>
  | 						<a4j:region>
  | 							<s:decorate id="shipyardDecoration">
  | 								<h:selectOneMenu id="shipyard"
  | 									value="#{vesselHome.instance.shipyard}" required="true">
  | 									<s:selectItems value="#{shipyardFilter.shipyards}" var="shipyard"
  | 										label="#{shipyard.name}" noSelectionLabel="Please Select..."
  | 										hideNoSelectionLabel="true" />
  | 									<a4j:support event="onchange" reRender="shipyardDecoration" />
  | 									<s:convertEntity />
  | 								</h:selectOneMenu>
  | 							</s:decorate>
  | 						</a4j:region>
  | 						<f:subview id="location1">
  | 							<ui:include src="VesselLocation.xhtml" />
  | 						</f:subview>
  | 						
  | 					</h:panelGrid>
  | 
  | 				</a4j:outputPanel></fieldset>
  | 			</h:outputText>
  | 
  | 			
  | 
  | 
  | 		</rich:panel>
  | 
  | 		<div class="actionButtons"><h:commandButton id="save"
  | 			value="Save" action="#{vesselHome.persist}"
  | 			disabled="#{!vesselHome.wired}" rendered="#{!vesselHome.managed}" />
  | 
  | 		<h:commandButton id="update" value="Save"
  | 			action="#{vesselHome.update}" rendered="#{vesselHome.managed}" /> <h:commandButton
  | 			id="delete" value="Delete" action="#{vesselHome.remove}"
  | 			rendered="#{vesselHome.managed}" /> <s:button id="done" value="Done"
  | 			propagation="end" view="/Vessel.xhtml"
  | 			rendered="#{vesselHome.managed}" /> <s:button id="cancel"
  | 			value="Cancel" propagation="end"
  | 			view="/#{empty vesselFrom ? 'VesselList' : vesselFrom}.xhtml"
  | 			rendered="#{!vesselHome.managed}" /></div>
  | 	</h:form>
  | 
  | 	</body>
  | 
  | 	</html>
  | 
  | </f:view>
  | 


  | package gov.dot.marad.business.ejb;
  | 
  | import gov.dot.marad.persistence.ejb.model.Shipyard;
  | import gov.dot.marad.persistence.ejb.model.VesselHome;
  | 
  | import java.util.List;
  | 
  | import javax.ejb.Stateless;
  | import javax.persistence.EntityManager;
  | 
  | import org.jboss.seam.annotations.Factory;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.datamodel.DataModel;
  | 
  | @Stateless
  | @Name("shipyardFilter")
  | public class ShipyardFilterAction implements ShipyardFilter
  | {
  | 	@Out
  | 	private int statusId = 1;
  | 	
  | 	private List<Shipyard> shipyards;
  | 	
  | 	@In(create = true)
  | 	EntityManager entityManager; 
  | 	
  | 	@In
  | 	VesselHome vesselHome;
  | 	
  | 	  
  | 	public EntityManager getEntityManager()
  | 	{
  | 	  return entityManager;
  | 	} 
  | 	
  | 	public int getStatusId()
  | 	{
  | 		return this.statusId;
  | 	}
  | 	
  | 	@SuppressWarnings("unchecked")
  | 	@DataModel
  | 	public List <Shipyard> getShipyards()
  | 	{
  | 		
  | 		shipyards = getEntityManager().createQuery(
  | 				" select shipyard from Shipyard shipyard " +
  | 				" where shipyard.shipyardStatus.statusId=:status") 
  | 				.setParameter("status",  getStatusId()).getResultList();
  | 			
  | 		return shipyards;
  | 	}
  | 
  | }
  | 

I've tried various ways of using the @In annotation to no avail.
Any help would be appreciated.

JR

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

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



More information about the jboss-user mailing list