velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben <newread...@gmail.com>
Subject Re: Equivalent to pageContext
Date Tue, 19 Oct 2004 00:27:27 GMT
Thank you for your reply Shinobu.

> I think the ViewContext itself is somewhat like PageContext.
I am using ViewContext.

> I don't know how the Struts-Menu Taglibs works, but where(how) are you
> putting your login info?
I am using Container Managed Security with Tomcat. Struts-Menu has a
role adapter where it hides/unhides a menu/item based on the role.

> By "initialize", what do you mean?
I mean the instance gets created on each request.

> Let's say you are talking about tools.  If your tool implements the
> ViewTool interface, you will receive the Context in the init(Object)
> method on each request (so long as you put the tool in request scope).
I am implementing the ViewTool interface and do initialize stuff in
the init() method.

In one session, I login as admin and see the full menu. In another
session I login as normal user and see the restricted menu. I refresh
the page in the admin user session and see the restricited menu (not
the full menu).

The permission works for the menu but doens't work for the menu item.
If I define three seperate menus for each role then the users see the
correct menus. If I define one menu and each menu item has different
role then the problem occurs.

Thanks,
Ben

On Mon, 18 Oct 2004 23:19:01 +0900, Shinobu Kawai
<shinobu.kawai@gmail.com> wrote:
> Hi Ben,
> 
> > In Velocity, which instance I can use that has the same functionality
> > as the pageContext?
> I think the ViewContext itself is somewhat like PageContext.
> 
> > I am trying to convert Struts-Menu Taglibs to Velocity Toolbox and
> > everything seems to be working fine except the permissions.
> >
> > The scenario:
> >
> > The 'admin' has full menu, the 'user' has restricted menu.
> >
> > 1) Startup Tomcat.
> > 2) Login as admin and see full menu and logout
> > 3) Login as user and see restricted menu and logout
> > 4) Login as admin and NOT see the full menu but see the restricted menu instead
> > 5) Continuously switching user but I can only see the restricted menu.
> >
> > The only way I can see the full menu is to restart Tomcat and login as admin.
> I don't know how the Struts-Menu Taglibs works, but where(how) are you
> putting your login info?
> 
> > I am currently using viewContext but I believe this instance gets
> > initialize once when Tomcat starts up. Whereas with pageContext it
> > gets initialize with each JSP page.
> By "initialize", what do you mean?  At least instances of
> (View)Context get created on each request.  Velocity itself and the
> toolbox gets initialized on (Servlet) context initialization.
> (Assuming that you are using VelocityViewServlet, of course.)
> 
> Let's say you are talking about tools.  If your tool implements the
> ViewTool interface, you will receive the Context in the init(Object)
> method on each request (so long as you put the tool in request scope).
>      http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/view/tools/ViewTool.html#init(java.lang.Object)
> 
> Best regards,
> -- Shinobu Kawai
> 
> --
> Shinobu Kawai <shinobu.kawai@gmail.com>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message