[jboss-user] [JBoss Seam] - Did this -- but not working (Re: Newbei question: Page navig

zwu_ca do-not-reply at jboss.com
Thu May 24 10:15:17 EDT 2007


Thanks for help -- this has been driving me crazy (more than 12 hours have been spent -- a newbie in Seam).

I think I did do this: Could you look at what's wrong with the navigation (I also include the related Java code). Your help will be much appreciated. 





<page view-id="/home.xhtml">
        
            
                <redirect view-id="/itemlist.xhtml"/>
            
        
        
    
    <page view-id="/itemlist.xhtml"  login-required="true" >
            
          <navigation from-action="#{hotelBooking.cancel}">
            <redirect view-id="/main.xhtml"/>
          
     


import javax.ejb.*;
/**
 *
 * @author WuZX
 */
@Local
public interface Itemlist
{
   UploadedData getData();
   String getMe();
   void setMe(String me);
   /*
   public void setDamn(String id); 
   public String getDamn();
    */
    public void destroy();
   
}


/**
 *
 * @author WuZX
 */
import static org.jboss.seam.ScopeType.STATELESS;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.RequestParameter;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
import javax.ejb.Remove;
import javax.ejb.*;

import org.jboss.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;


@Stateful
@Name("itemlist")

//@Scope(STATELESS)
public class ItemlistAction implements Itemlist {
    
   //@In String id;
   
   // private UploadedData uploadedData;
   
    @PersistenceContext
    private EntityManager em;
    
   
    @RequestParameter("id")
    
    private String id;
    
   private static final Logger log = Logger.getLogger(ItemlistAction.class);
   static
   {
       log.info("loading?****************");
   }
   
   /*public String getData()
   {
       
       return "data" + id;
   }*/
    //@Out
    //@Factory("uploadedData")
   public UploadedData getData()
   {
       log.info("get here" + id);
       
       if (id == null ) 
       {
           //UploadedData uploadedData = new UploadedData();
           //uploadedData.setTesting("testing");
           return null;
       }
      return em.find(UploadedData.class, new Long(id));     
        
   }
   
   public String getMe()
   {
       return id;
   }
   
   public void setMe(String me)
   {
       id = me;
   }
   public int getDataID()
   {
       return 3;
      /* try
       {
       if (id != null)
       return  Integer.parseInt(id);
       }
       catch(Exception e)
       {
           
       }
       return 0;
       */
   }
  
   @Destroy @Remove
   public void destroy() {}
}



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

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



More information about the jboss-user mailing list