[jboss-user] [JBoss Seam] - Re: Problems with application-like behaviour project

raffaele.camanzo do-not-reply at jboss.com
Tue Oct 31 11:48:00 EST 2006


Waiting for an advice I tried another solution, this does not fail, but does not do what I want: 
I modified the conversation generation in order to provide a conversation id as a commandLink parameter (<f:param name="conversationId" value="#{contextTab.token} />), the conversationId value is passed correctly but ignored by Seam.

layout.xhtml:


  | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns="http://www.w3.org/1999/xhtml"
  | 		xmlns:ui="http://java.sun.com/jsf/facelets"
  | 		xmlns:h="http://java.sun.com/jsf/html"
  | 		xmlns:f="http://java.sun.com/jsf/core"
  | 		xmlns:s="http://jboss.com/products/seam/taglib"
  | 		xmlns:c="http://java.sun.com/jstl/core">
  | 
  | <f:view>
  | 
  | 	<f:loadBundle basename="main" var="mainmsg" />
  | 	<f:loadBundle basename="messages" var="msgs" />
  | 
  | 	
  | 	<head>
  | 		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  | 		<title><h:outputText value="#{mainmsg.title}" /></title>
  | 		<link href="css/main.css" rel="stylesheet" type="text/css"/>
  | 	</head>
  | 	
  | 	<body>
  | 
  | 		<div id="document">
  | 			<div id="header">
  | 				<div id="title"></div>
  | 				<div id="status">
  |                                     <ui:insert name="status" />
  | 				</div>
  | 			</div>
  | 			<div id="container">
  | 				<div id="leftside">
  | 				</div>
  | 				<div id="rightside">
  | 					<div id="ContextView">
  | 					
  | 						<div id="slidingContext">
  | 							<h:form>
  | 								<ul>
  | 									<c:forEach items="#{sessionHandler.contextTabs}" var="contextTab">
  | 										<li>
  | 											<h:commandLink action="#{provaAction.startConversation}">
  | 												<h:outputText value="label" />
  | 												<f:param name="token" value="#{contextTab.token}" />
  | 												<f:param name="conversationId" value="#{contextTab.token}" />
  | 											</h:commandLink>
  | 										</li>
  | 									</c:forEach>
  | 								</ul>
  | 							</h:form>
  | 						</div>
  | 				
  | 					</div>
  | 					<ui:insert name="contextmanager" />
  | 				</div>
  | 			</div>
  | 		</div>
  | 
  | 	</body>
  | 	
  | </f:view>
  | </html>
  | 

the ProvaAction.java:


  | import javax.ejb.Remove;
  | import javax.ejb.Stateful;
  | import javax.faces.context.FacesContext;
  | import javax.faces.event.ActionEvent;
  | 
  | import org.jboss.logging.Logger;
  | import org.jboss.seam.annotations.Begin;
  | import org.jboss.seam.annotations.Conversational;
  | import org.jboss.seam.annotations.Create;
  | import org.jboss.seam.annotations.Destroy;
  | import org.jboss.seam.annotations.End;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.RequestParameter;
  | import org.jboss.seam.core.Conversation;
  | import org.jboss.seam.core.Manager;
  | 
  | @Stateful
  | @Name("provaAction")
  | @Conversational
  | public class ProvaAction implements Prova {
  | 
  | 	@RequestParameter(value="token")
  | 	private String tok; 
  | 	
  | 	@RequestParameter(value="conversationId")
  | 	private String conv; 
  | 
  | 	@Begin(join=true)
  | 	public String startConversation() {
  | 		FacesContext context = FacesContext.getCurrentInstance();
  | 		String tokz = (String) context.getExternalContext().getRequestParameterMap().get("token");
  | 		Logger.getLogger(this.getClass()).info("TOKEN IS: " + tokz);
  | 		Logger.getLogger(this.getClass()).info("TOKEN FROM REQUEST PARAMETER IS: " + tok);
  | 		Logger.getLogger(this.getClass()).info("CONVERSATION ID PARAMETER IS: " + conv);
  | 
  | 		Logger.getLogger(this.getClass()).info("CONVERSATION IS: " + Conversation.instance().getId());
  | 		return "prova";
  | 	}
  | 
  | 	@End
  | 	public String endConversation() {
  | 		// TODO Auto-generated method stub
  | 		return null;
  | 	}
  | 
  | 	@Remove @Destroy
  | 	public void destroy() {
  | 		// TODO Auto-generated method stub
  | 
  | 	}
  | }
  | 

which produces the following output:

2006-10-31 17:32:46,542 INFO  [it.finservice.organizer.modules.dummy.components.ProvaAction] TOKEN IS: token1
2006-10-31 17:32:46,543 INFO  [it.finservice.organizer.modules.dummy.components.ProvaAction] TOKEN FROM REQUEST PARAMETER IS: token1
2006-10-31 17:32:46,543 INFO  [it.finservice.organizer.modules.dummy.components.ProvaAction] CONVERSATION ID PARAMETER IS: token1
2006-10-31 17:32:46,543 INFO  [it.finservice.organizer.modules.dummy.components.ProvaAction] CONVERSATION IS: 4


Help really appreciated.

Regards,
Raffaele

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

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



More information about the jboss-user mailing list