Hmm. Looks ok (but I don't use annotations, either). Are you sure
that the hivemodule.xml file is being copied over to the classes
directory? Check that.
I find it easier (for webapps) to just drop it directly in the WEB-INF
directory. Since you're typically running tomcat with the docBase
pointing back to your project (for development, anyway -- and likely
so if you are using Kent's book) this should work fine.
-Mike
On 3/26/06, GbT <[EMAIL PROTECTED]> 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]