-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Make sure your hivemodule.xml is either in WEB-INF/ or classes/META-INF
otherwise it will not be processed.

HTH
Brian

GbT wrote:
> Hi to all,
> I am in trouble getting application state objects to work... I want to
> use a class named Visita in my package com.mypackage... and write this
> hivemind.xml file in src/META-INF as explained in Kent Tong book:
> 
> <?xml version="1.0"?>
> <module id="com.mypackage" version="1.0.0" package="com.mypackage">
>       <contribution configuration-id="tapestry.state.ApplicationObjects">
>               <state-object name="visita" scope="session">
>                       <create-instance class="com.mypackage.Visita"/>
>               </state-object>
>       </contribution>
> </module>
> 
> I'm using cayenne for the persistence... Visita.java is simple:
> 
> package com.mypackage;
> import java.io.Serializable;
> import java.util.List;
> import org.apache.tapestry.IRequestCycle;
> import org.objectstyle.cayenne.access.*;
> import org.objectstyle.cayenne.query.*;
> import com.mypackage.logic.*;
> 
> public class Visita implements Serializable {
>     protected DataContext dataContext;
>     protected Menu currentMenu;
>     public Visita() {
>       super();
>         this.dataContext = DataContext.createDataContext();
>     }
>     public DataContext getDataContext() {
>         return dataContext;
>     }
>       public void setCurrentMenu(Menu menu) {
>               currentMenu = menu;
>       }
>       public List getMenus() {
>       if (currentMenu!=null) {
>               return currentMenu.getSons();
>       }
>       SelectQuery query = new SelectQuery(Menu.class);
>               return getDataContext().performQuery(query);
>     }
> }
> 
> I inject visita in Home.java with:
> @InjectState("visita")
> public abstract Visita getVisita();
> 
> But everytime I try to access Home to display visita.menus... i get this 
> error:
> 
> Unable to read OGNL expression '<parsed OGNL expression>' of
> [EMAIL PROTECTED]: visita
> 
> ... 'visita' is not a declared application state object.
> 
> What's wrong???
> 
> And what's the best way to store the currentMenu a user is displaying?
> I choose to use the Visita.currentMenu object (in the session).
> 
> Thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFEJrGbaCoPKRow/gARAlABAJ9Ez2sgYLCM/m0RwoK9SwbbLp3sAQCfSCcf
ZWbSf6+iVeYk7uJZhnaZ9ls=
=K8Ww
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to