Hi Sneha,
Saving your User object into the application Session make it available to
all JSP's and ActionBeans.
Example in an ActionBean (using your AnoigmaActionBeanContext) :
*getContext().getUser();
*
Example in a 'hidden' JSP (in /WEB-INF directory) forwarded by an ActionBean
with ForwardResolution("/WEB-INF/my_jsp.jsp") :
*<div>User : ${actionBean.context.user }</div>
*
Example in a 'public' JSP accessed directly like /profile.jsp
*<div>User : ${sessionScope['user'] }</div>
*
If you have doubts with EL syntax, see examples there :
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html
Hope this help !
Regards,
Simon
2009/3/24 Mike McNally <[email protected]>
> Usually web applications are set up such that all the .jsp pages are
> "protected" in the WEB-INF tree. Thus you're always going through an
> action bean to get from one page to another. Because of that, the
> action bean that forwards to your profile.jsp page will automatically
> be available to the page; Stripes binds it to the name "actionBean" in
> the request context (I think).
>
>
> On Tue, Mar 24, 2009 at 8:22 AM, Sneha Manohar
> <[email protected]> wrote:
> > Thanks Mike . How do I make actionBean avilable to profile.jsp . As
> > profile.jsp is the link on index.jsp . Do I need to create the instance
> of
> > it on profile.jsp
> >
> >
> > --- On Tue, 24/3/09, Mike McNally <[email protected]> wrote:
> >
> > From: Mike McNally <[email protected]>
> > Subject: Re: [Stripes-users] passing object from page1 to page 2
> > To: "Stripes Users List" <[email protected]>
> > Date: Tuesday, 24 March, 2009, 5:46 PM
> >
> > There's no need to save in the context. Just make it a property of the
> > action bean itself. Then, from profile.jsp, you can refer to the user
> > object with a JSTL expression like
> > "${actionBean.user.someUserProperty}".
> >
> >
> > On Tue, Mar 24, 2009 at 7:11 AM, Sneha Manohar
> > <[email protected]> wrote:
> >> Hi All ,
> >> I have link on index.jsp <a href="/profile.jsp"> profile.jsp</a>
> >>
> >> My LogInActionBean sets the user & forwords to index.jsp. I wish to
> pass
> >> user object to profile.jsp ..can you pls help me in this regard.
> >>
> >> public class LoginActionBean extends AnoigmaActionBean {
> >>
> >> this.setUser(user);
> >> return new ForwardResolution("/index_1.jsp");
> >> }
> >>
> >> This user object is saved in the context
> >>
> >> public class AnoigmaActionBeanContext extends ActionBeanContext {
> >> public User getUser() {
> >> return (User) getRequest().getSession().getAttribute("user");
> >> }
> >> /** Sets the currently logged in user. */
> >> public void setUser(User currentUser) {
> >> getRequest().getSession().setAttribute("user", currentUser);
> >> }
> >>
> >> Thanks
> >> Sneha
> >>
> >> ________________________________
> >> Connect with friends all over the world. Get Yahoo! India Messenger.
> >>
> >>
> ------------------------------------------------------------------------------
> >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> >> easily build your RIAs with Flex Builder, the Eclipse(TM)based
> development
> >> software that enables intelligent coding and step-through debugging.
> >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> >> _______________________________________________
> >> Stripes-users mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/stripes-users
> >>
> >>
> >
> >
> >
> > --
> > Turtle, turtle, on the ground,
> > Pink and shiny, turn around.
> >
> >
> ------------------------------------------------------------------------------
> > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> > easily build your RIAs with Flex Builder, the Eclipse(TM)based
> development
> > software that enables intelligent coding and step-through debugging.
> > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> > _______________________________________________
> > Stripes-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/stripes-users
> >
> > ________________________________
> > Share files, take polls, and make new friends - all under one roof. Click
> > here.
> >
> ------------------------------------------------------------------------------
> > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> > easily build your RIAs with Flex Builder, the Eclipse(TM)based
> development
> > software that enables intelligent coding and step-through debugging.
> > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> > _______________________________________________
> > Stripes-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/stripes-users
> >
> >
>
>
>
> --
> Turtle, turtle, on the ground,
> Pink and shiny, turn around.
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users