[jboss-user] [JBoss Seam] - @Out frustration

texan do-not-reply at jboss.com
Thu Sep 7 13:47:25 EDT 2006


I can't get @Out to work as I expected.  I'm just testing a trivial stateless session bean with a trivial page.  I create a bean, outject it, and try to display its attribute on the page.

The problem is, the bean never makes into the scope that the page is rendered under.  If I view "debug.seam", there are no beans in any scope (other than the definitions in the application scope).

However, if I add "(scope=ScopeType.SESSION)" tothe @Out tag, all is well.

I tried other scopes like EVENT and PAGE with no success.  How do I simply outject a bean to the page that I'm displaying???  I don't want it in SESSION scope, and there's no value in a conversation in this case.

Here is my code.  Let me know if you need my vast array of config files..

package mypackage;
  | 
  | import javax.ejb.Local;
  | 
  | @Local
  | public interface Test {
  | 
  |     public String view();
  | }

package mypackage;
  | 
  | import javax.ejb.Stateless;
  | 
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | 
  | @Name("test")
  | @Stateless
  | public class TestAction implements Test {
  | 
  |     @Out
  |     private Bean bean;
  | 
  |     public TestAction() {
  |     }
  | 
  |     public String view() {
  |         bean = new Bean("I am a bean");
  |         return "/test.xhtml";
  |     }
  | 
  | }

package mypackage;
  | 
  | import org.jboss.seam.annotations.Name;
  | 
  | @Name("bean")
  | public class Bean {
  | 
  |     private String name;
  | 
  |     public Bean() {
  | 
  |     }
  | 
  |     public Bean(String name) {
  |         this();
  |         setName(name);
  |     }
  | 
  |     public String getName() {
  |         return this.name;
  |     }
  | 
  |     public void setName(String name) {
  |         this.name = name;
  |     }
  | 
  | }

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
  |     xmlns:s="http://jboss.com/products/seam/taglib" xmlns:t="http://myfaces.apache.org/tomahawk"
  |     xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" prefix="h"
  |     xmlns:c="http://java.sun.com/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions">
  | 
  | <body>
  |     <h:form>
  |         <h:inputText value="#{bean.name}" />
  |         <s:link linkStyle="button" action="#{test.view}" value="View" />
  |     </h:form>
  | </body>
  | </html>


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

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



More information about the jboss-user mailing list