[jboss-user] [JBoss Seam] - Re: Stateless search to stateful conversation

justinwalsh do-not-reply at jboss.com
Thu Jul 20 00:31:40 EDT 2006


Hi,

I've tried this.  When the page action is executed, the request parameter is not present yet.  A simple example:

ViewDocument:

  | @Local
  | public interface ViewDocument {
  | 	void selectDocument();
  | 	void destroy();
  | }
  | 

ViewDocumentAction:

  | @Stateful
  | @Name("viewDocumentAction")
  | @Scope(ScopeType.CONVERSATION)
  | public class ViewDocumentAction implements ViewDocument {
  | 	
  | 	@RequestParameter
  | 	private Integer documentId;
  | 	
  | 	@Begin
  | 	public void selectDocument() {
  | 		System.out.println("documentId [" + documentId + "]");
  | 		if (documentId == null) {
  | 			throw new IllegalStateException("DocumentId is null");
  | 		}
  | 	}
  | 	
  | 	@Remove @Destroy @End 
  | 	public void destroy() {
  | 		
  | 	}
  | 
  | }
  | 

Invoked from:

  |        <h:outputLink value="viewDocument.seam" id="viewDocument">
  | 		<h:outputText value="[View Document]"/>
  | 		<f:param name="documentId" value="1" />
  | 	</h:outputLink>
  | 

pages.xml

  | <pages>
  |    <page view-id="/viewDocument.xhtml" action="#{viewDocumentAction.selectDocument}"/>
  | </pages>
  | 

06:26:49,735 INFO  [STDOUT] documentId [null]
06:26:49,735 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet
 threw exception
javax.faces.el.EvaluationException: Exception while invoking expression #{viewDocumentAction.selectDocument}
....
Caused by: javax.ejb.EJBException: java.lang.IllegalStateException: DocumentId is null
        at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.ja
va:69)

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

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



More information about the jboss-user mailing list