[jboss-user] [JBoss Seam] - JSF/Bean binding dropped when using s:link

thatrichard do-not-reply at jboss.com
Tue Jun 12 08:48:51 EDT 2007


Short version: When I navigate using an s:link then any data entered into form fields disappears.  Everything works ok when I use commandLinks.

Long version:
I've created a tabbed form using a conversation.  The user moves between tabs by clicking on links.  At any time, the user can persist the form data by pressing a Save button. 

Here is the Session Bean and JSF pages (the first JSF page creates the tabs, the second creates a tab which is inserted into the first). 

Note that I've duplicated the tab links.  The link with the 2 appended is implemented with commandLink and the second one with s:link.

If I use the commandLinks, everthing behaves as expected.  I can navigate between the tabs and enter data.  When I hit save the data is persisted.  However, when I use the s:links then the data disappears.  For example, if I enter a last name and then navigate to the second tab and back, the last name has disappeared.

Does anyone know what is going on?

Richard


  | @Name("personEditor")
  | @Stateful
  | @Scope(ScopeType.CONVERSATION)
  | @Conversational	
  | public class PersonEditorBean implements PersonEditor {
  | 	
  | 	private Person person;
  | 
  | 	@In
  | 	private Session session;
  | 	
  | 	@Logger
  | 	private Log log;
  | 
  | 	@In(required=false)
  | 	public void setPerson(Person person) {
  | 		this.person = person;
  | 	}
  | 	
  | 	@Out
  | 	public Person getPerson() {
  | 		if (person == null) {
  | 			person = new Person();
  | 		}
  | 		return person;
  | 	}
  | 	
  | 	@Begin(flushMode=FlushModeType.MANUAL, join=true)
  | 	public String enterIdentity() {
  | 		return "/forms/party/person/identity";
  | 
  | 	}
  | 	
  | 	public String enterBanking() {
  | 		return "/forms/party/person/banking";
  | 
  | 	}
  | 
  | 	public void save() {
  | 		session.save(person);
  | 		session.flush();
  | 	}	
  | 
  | 	@Remove @Destroy
  | 	public void destroy() { }
  | }


  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE html
  |   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns:f="http://java.sun.com/jsf/core"
  | 	xmlns:h="http://java.sun.com/jsf/html"
  | 	xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	xmlns:s="http://jboss.com/products/seam/taglib"
  | 	xmlns="http://www.w3.org/1999/xhtml">
  | <head>
  | <title>Person</title>
  | </head>
  | <body>
  | <ui:composition xmlns:rich="http://richfaces.ajax4jsf.org/rich"
  | 	template="person.xhtml">
  | 	<ui:define name="tab">
  | 
  | 		<div name="tabset-actions" />
  | 		<div name="tabset-links">
  | 		<ul class="tabset" />
  | 		</div>
  | 		<div class="tab"><ui:insert name="tab" /></div>
  | 
  | 		<h:outputLabel value="Title" for="title" />
  | 		<h:inputText id="title" value="#{person.title}" />
  | 		<h:outputLabel value="Last Name" for="lastName" />
  | 		<h:inputText id="lastName" value="#{person.lastName}" />
  | 
  | 		<h:outputLabel value="Date of Birth" for="dateOfBirth" />
  | 		<h:inputText id="dateOfBirth" value="#{person.dateOfBirth}" />
  | 		<h:outputLabel value="Preferred Language" for="preferredLanguage" />
  | 		<h:inputText id="preferredLanguage"
  | 			value="#{person.preferredLanguage}" />
  | 
  | 
  | 	</ui:define>
  | </ui:composition>
  | </body>
  | </html>
  | 
  | 


  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE html
  |   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns:f="http://java.sun.com/jsf/core"
  | 	xmlns:h="http://java.sun.com/jsf/html"
  | 	xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	xmlns:s="http://jboss.com/products/seam/taglib"
  | 	xmlns="http://www.w3.org/1999/xhtml">
  | <head>
  | <title>Person</title>
  | </head>
  | <body>
  | <ui:composition xmlns:rich="http://richfaces.ajax4jsf.org/rich"
  | 	template="/layout/template.xhtml">
  | 	<ui:define name="body">
  | 		<h:form id="form">
  | 
  | 
  | 			<div name="tabset-actions"><s:button value="Save"
  | 				action="#{personEditor.save}" /></div>
  | 			<div name="tabset-links">
  | 			<ul class="tabset">
  | 				<li><h:commandLink id="identity" value="Identity2"
  | 					action="#{personEditor.enterIdentity}" /> <s:link value="Identity"
  | 					action="#{personEditor.enterIdentity}" /></li>
  | 				<li><h:commandLink id="banking" value="Banking2"
  | 					action="#{personEditor.enterBanking}" /> <s:link value="Banking"
  | 					action="#{personEditor.enterBanking}" /></li>
  | 			</ul>
  | 			</div>
  | 			<div class="tab"><ui:insert name="tab" /></div>
  | 
  | 		</h:form>
  | 	</ui:define>
  | </ui:composition>
  | </body>
  | </html>
  | 
  | [img][/img]

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

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



More information about the jboss-user mailing list