[jboss-user] [JBoss Seam] - Re: Newbei question: Page navigation

zwu_ca do-not-reply at jboss.com
Thu May 24 11:29:50 EDT 2007


 First I am so thankful you are so patient and so willing to help -- very rarely.

  I don't see 'a' anywhere in the original code posting. I forgot to use the 'code' html tag in the original code. There might be some confusion there (you might have different views from mine?). I will try to post the code again here (hopefully this time it can be resolved ).


  |    
  |     <page view-id="/home.xhtml">
  |         
  |         <navigation>
  |             <rule if="#{identity.loggedIn}">
  |                 <redirect view-id="/itemlist.xhtml"/>
  |             </rule>
  |         </navigation>
  |         
  |     </page>
  |     <page view-id="/itemlist.xhtml"  login-required="true" >
  |             <param name="id" value="#{itemlist.me}" />
  |           <navigation from-action="#{hotelBooking.cancel}">
  |             <redirect view-id="/main.xhtml"/>
  |         </navigation>  
  |     </page> 
  | 
  | 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 org.jboss.seam.annotations.Scope;
  | import javax.ejb.Remove;
  | import javax.ejb.*;
  | import static org.jboss.seam.ScopeType.*;
  | 
  | import org.jboss.logging.Logger;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | 
  | 
  | @Stateful
  | @Name("itemlist")
  | @Scope(EVENT)
  | public class ItemlistAction implements Itemlist {
  |     
  |    //@In String id;
  |    
  |    // private UploadedData uploadedData;
  |    
  |     @PersistenceContext
  |     private EntityManager em;
  |     
  |    
  |     @RequestParameter("id")
  |     private String me;
  |     
  |    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" + me);
  |        
  |        if (me == null ) 
  |        {
  |            //UploadedData uploadedData = new UploadedData();
  |            //uploadedData.setTesting("testing");
  |            return null;
  |        }
  |       return em.find(UploadedData.class, new Long(me));     
  |         
  |    }
  |    
  |    public String getMe()
  |    {
  |         log.info("===============get me " + me);
  |        
  |        return me;
  |    }
  |    
  |    public void setMe(String me)
  |    {
  |         log.info("================= set me here" + me);
  |        
  |        this.me = 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=4048362#4048362

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



More information about the jboss-user mailing list