[Stripes-users] ActionBean and PageOnLoad

2010-11-06 Thread dimension123 dimension123
Hi,

I am using stripes layout to create a 'master page' of sorts.  One of the
layout component (the 'header' layout) is responsible for rending the
horizontal tab menu on the page.  Since this is the header, it appears for
all pages of course.  I need the tabs that are displayed to be dynamic based
on user roles.  For instance,  If a user is Guest vs a Registered User, the
tabs will be different.  If a user is an Administrator, an Admin tab will
show. etc.

My base actionbean has a method that that delegates to a SecurityService
that can determine which roles a user has.  The issue i'm having is how to
do this the 'right' way. Right now, when you first land on a page, it does
not appear as though there is a way to invoke an actionbean method.  This
seems to happen only if you submit the page or if you use a url that is
bound to the actionbean (i.e. /MyActionBean.action).  It seems as though the
ActionBean does not really come into scope until that happens.

Is there away to make an actionbean come into scope when a page is first
loaded?
Is there away to bind an actionbean to a stripes layout component such that,
in the case described above, that action bean will always be available to
the web application (given that the header is always displayed)?
If i can do that, i figure i would have what i need to solve the problem.

Are there other ways anyone can recommend to solve this problem?

thanks,
Mike
--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] ActionBean and PageOnLoad

2010-11-06 Thread Nikolaos Giannopoulos
Mike,

What you are looking for and more is covered in Freddy Daoud's book on 
Stripes.

The mechanism you are looking for is as follows:

s:url var=url 
beanclass=org.test.ui.web.action.view.support.MenuViewHelper 
prependContext=false
s:param name=currentSection value=${currentSection} /
/s:url
jsp:include page=${url} /

There is a lot happening there so have fun... and get the book (it goes 
into more detail on how the sections can be represented using enums and 
localization and more)... its well worth it... .

--Nikolaos



dimension123 dimension123 wrote:
 Hi,

 I am using stripes layout to create a 'master page' of sorts.  One of 
 the layout component (the 'header' layout) is responsible for rending 
 the horizontal tab menu on the page.  Since this is the header, it 
 appears for all pages of course.  I need the tabs that are displayed 
 to be dynamic based on user roles.  For instance,  If a user is Guest 
 vs a Registered User, the tabs will be different.  If a user is an 
 Administrator, an Admin tab will show. etc.

 My base actionbean has a method that that delegates to a 
 SecurityService that can determine which roles a user has.  The issue 
 i'm having is how to do this the 'right' way. Right now, when you 
 first land on a page, it does not appear as though there is a way to 
 invoke an actionbean method.  This seems to happen only if you submit 
 the page or if you use a url that is bound to the actionbean (i.e. 
 /MyActionBean.action).  It seems as though the ActionBean does not 
 really come into scope until that happens.

 Is there away to make an actionbean come into scope when a page is 
 first loaded? 
 Is there away to bind an actionbean to a stripes layout component such 
 that, in the case described above, that action bean will always be 
 available to the web application (given that the header is always 
 displayed)?  
 If i can do that, i figure i would have what i need to solve the problem.

 Are there other ways anyone can recommend to solve this problem?

 thanks,
 Mike
 

 --
 The Next 800 Companies to Lead America's Growth: New Video Whitepaper
 David G. Thomson, author of the best-selling book Blueprint to a 
 Billion shares his insights and actions to help propel your 
 business during the next growth cycle. Listen Now!
 http://p.sf.net/sfu/SAP-dev2dev
 

 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users
   


--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] ActionBean and PageOnLoad

2010-11-06 Thread dimension123 dimension123
Nice. I had actually ordered that book this morning before even posting my
question.  I was hoping for a solution before the book gets here however.
In my case i'm not really trying to build a menu, but rather tabs.  To do
that, i feel i need a way to be able to reference an actionbean from the
layout component that is always visible and when pages are loaded rather
than submitted.  That way i can either call a method on the actionbean to
determine if the current user is entitled or not to view certain areas of
the page.
Not quite sure yet how to do it.

On Sat, Nov 6, 2010 at 8:29 PM, Nikolaos Giannopoulos 
nikol...@brightminds.org wrote:

 Mike,

 What you are looking for and more is covered in Freddy Daoud's book on
 Stripes.

 The mechanism you are looking for is as follows:

s:url var=url
 beanclass=org.test.ui.web.action.view.support.MenuViewHelper
 prependContext=false
s:param name=currentSection value=${currentSection} /
/s:url
jsp:include page=${url} /

 There is a lot happening there so have fun... and get the book (it goes
 into more detail on how the sections can be represented using enums and
 localization and more)... its well worth it... .

 --Nikolaos



 dimension123 dimension123 wrote:
  Hi,
 
  I am using stripes layout to create a 'master page' of sorts.  One of
  the layout component (the 'header' layout) is responsible for rending
  the horizontal tab menu on the page.  Since this is the header, it
  appears for all pages of course.  I need the tabs that are displayed
  to be dynamic based on user roles.  For instance,  If a user is Guest
  vs a Registered User, the tabs will be different.  If a user is an
  Administrator, an Admin tab will show. etc.
 
  My base actionbean has a method that that delegates to a
  SecurityService that can determine which roles a user has.  The issue
  i'm having is how to do this the 'right' way. Right now, when you
  first land on a page, it does not appear as though there is a way to
  invoke an actionbean method.  This seems to happen only if you submit
  the page or if you use a url that is bound to the actionbean (i.e.
  /MyActionBean.action).  It seems as though the ActionBean does not
  really come into scope until that happens.
 
  Is there away to make an actionbean come into scope when a page is
  first loaded?
  Is there away to bind an actionbean to a stripes layout component such
  that, in the case described above, that action bean will always be
  available to the web application (given that the header is always
  displayed)?
  If i can do that, i figure i would have what i need to solve the problem.
 
  Are there other ways anyone can recommend to solve this problem?
 
  thanks,
  Mike
  
 
 
 --
  The Next 800 Companies to Lead America's Growth: New Video Whitepaper
  David G. Thomson, author of the best-selling book Blueprint to a
  Billion shares his insights and actions to help propel your
  business during the next growth cycle. Listen Now!
  http://p.sf.net/sfu/SAP-dev2dev
  
 
  ___
  Stripes-users mailing list
  Stripes-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/stripes-users
 



 --
 The Next 800 Companies to Lead America's Growth: New Video Whitepaper
 David G. Thomson, author of the best-selling book Blueprint to a
 Billion shares his insights and actions to help propel your
 business during the next growth cycle. Listen Now!
 http://p.sf.net/sfu/SAP-dev2dev
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] ActionBean and PageOnLoad

2010-11-06 Thread Nikolaos Giannopoulos
Mike,

MenuViewHelper is an ActionBean (sorry if the name is a little 
deceiving).  s:url constructs a URL to the ActionBean and the 
jsp:include includes the ActionBean which essentially processes the 
default handler on the ActionBean and forwards to a a JSP.

Instead of building a menu in the JSP do whatever you like with your 
tabs and authorization.  It really doesn't matter whether its a menu or 
tabs its the idea that is key i.e. what I gave you was the key part 
which is how to inline / embed the output of the view of an ActionBean 
inside a JSP.

Simply place the block I gave you below within a layout-component tag in 
a nested layout and render and voila you are golden.

What do you feel is still missing?

--Nikolaos



dimension123 dimension123 wrote:
 Nice. I had actually ordered that book this morning before even 
 posting my question.  I was hoping for a solution before the book gets 
 here however.
 In my case i'm not really trying to build a menu, but rather tabs.  To 
 do that, i feel i need a way to be able to reference an actionbean 
 from the layout component that is always visible and when pages are 
 loaded rather than submitted.  That way i can either call a method on 
 the actionbean to determine if the current user is entitled or not to 
 view certain areas of the page.  
 Not quite sure yet how to do it.

 On Sat, Nov 6, 2010 at 8:29 PM, Nikolaos Giannopoulos 
 nikol...@brightminds.org mailto:nikol...@brightminds.org wrote:

 Mike,

 What you are looking for and more is covered in Freddy Daoud's book on
 Stripes.

 The mechanism you are looking for is as follows:

s:url var=url
 beanclass=org.test.ui.web.action.view.support.MenuViewHelper
 prependContext=false
s:param name=currentSection
 value=${currentSection} /
/s:url
jsp:include page=${url} /

 There is a lot happening there so have fun... and get the book (it
 goes
 into more detail on how the sections can be represented using
 enums and
 localization and more)... its well worth it... .

 --Nikolaos



 dimension123 dimension123 wrote:
  Hi,
 
  I am using stripes layout to create a 'master page' of sorts.
  One of
  the layout component (the 'header' layout) is responsible for
 rending
  the horizontal tab menu on the page.  Since this is the header, it
  appears for all pages of course.  I need the tabs that are displayed
  to be dynamic based on user roles.  For instance,  If a user is
 Guest
  vs a Registered User, the tabs will be different.  If a user is an
  Administrator, an Admin tab will show. etc.
 
  My base actionbean has a method that that delegates to a
  SecurityService that can determine which roles a user has.  The
 issue
  i'm having is how to do this the 'right' way. Right now, when you
  first land on a page, it does not appear as though there is a way to
  invoke an actionbean method.  This seems to happen only if you
 submit
  the page or if you use a url that is bound to the actionbean (i.e.
  /MyActionBean.action).  It seems as though the ActionBean does not
  really come into scope until that happens.
 
  Is there away to make an actionbean come into scope when a page is
  first loaded?
  Is there away to bind an actionbean to a stripes layout
 component such
  that, in the case described above, that action bean will always be
  available to the web application (given that the header is always
  displayed)?
  If i can do that, i figure i would have what i need to solve the
 problem.
 
  Are there other ways anyone can recommend to solve this problem?
 
  thanks,
  Mike
 
 
 
 
 
 --
  The Next 800 Companies to Lead America's Growth: New Video
 Whitepaper
  David G. Thomson, author of the best-selling book Blueprint to a
  Billion shares his insights and actions to help propel your
  business during the next growth cycle. Listen Now!
  http://p.sf.net/sfu/SAP-dev2dev
 
 
 
  ___
  Stripes-users mailing list
  Stripes-users@lists.sourceforge.net
 mailto:Stripes-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/stripes-users
 


 
 --
 The Next 800 Companies to Lead America's Growth: New Video Whitepaper
 David G. Thomson, author of the best-selling book Blueprint to a
 Billion shares his insights and actions to help propel your
 business during the next growth cycle. Listen