hello

i really don't get the reason for this strange problem:
first my environment:

the entity a simple foto with a number attribute


  | import java.io.Serializable;
  | 
  | import javax.persistence.*;
  | 
  | import org.jboss.seam.annotations.Name;
  | 
  | @Entity
  | @Name("photo")
  | public class Photo implements Serializable
  | {
  |     private static final long serialVersionUID = 1L;
  |     
  |     @Id @GeneratedValue
  |     private long id;
  |     private String number;
  |     
  |     public long getId() { return id;}
  |     public void setId(long id) { this.id = id; }
  | 
  |     public String getNumber() { return number; }
  |     public void setNumber(String number) { this.number = number; }
  | 
  | }
  | 
  | 

the facelet


  | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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";>
  | <head>    
  |     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" 
/>
  | </head>
  | <body>
  | 
  | <h:form>
  |     <h:inputText value="#{photo.number}"/>
  |     <h:commandButton type="submit" value="Add" 
action="#{formAction.addItem}"/>
  | </h:form>
  |  
  | <h:outputLink value="test.html" rendered="#{myservice.value == true}">Is 
True</h:outputLink> 
  |                     
  | </body>
  | </html>
  | 
  | 

with the corrosponding pages def.


  |    <page view-id="/test.xhtml">  
  |        <action execute="#{myservice.load}"/>
  |    </page>
  | 

and the bean from where the page gets the data


  | 
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.log.Log;
  | 
  | 
  | @Name("myservice")
  | @Scope(ScopeType.EVENT)
  | 
  | public class MyServiceBean
  | {
  |        @Logger
  |        private Log log;
  |        
  |        private boolean value = true;
  |        public boolean getValue() { return this.value; }
  |        
  |        @Out(required=false)
  |        private Photo photo;
  |        public Photo getPhoto()  { return this.photo; }
  |        
  |        public void load()
  |        {
  |                log.info("loading");
  |                
  |                this.photo = new Photo();
  |                this.photo.setNumber("testPhoto");
  |        }
  | }
  | 
  | 

so when the page is loaded the method load is executed and the photo is being 
outjected. which i then access in my facelet form


now to the strange part:


  | import javax.ejb.Remove;
  | import javax.ejb.Stateful;
  | 
  | import org.jboss.seam.annotations.Destroy;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.log.Log;
  | 
  | @Stateful
  | @Name("formAction")
  | 
  | public class FormActionBean implements FormAction
  | {
  |     @Logger
  |     private Log log;        
  |     
  |     @In
  |     Photo photo;
  | 
  |     public void addItem() 
  |     {
  |             log.info("adding: "+photo.getNumber());
  |     }
  | 
  |     @Remove @Destroy
  |     public void Destroy() {}
  |     
  | }
  | 
  | public interface FormAction 
  | {
  |     public void addItem();
  |     public void Destroy();  
  | }
  | 
  | 


when i try to submit the form and access the addItem method it won't work.
an exception is thrown because @In is not non-null
BUT it works when i put the outputlink above the form. 
i found out its the rendered attribute which messes it up. if i omit it there 
won't be an error

i hope someone can help me i tried to post all the necessary files

thanks in advance

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049312
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to