You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Giannopoulos <Pe...@gemplus.com> on 2001/05/31 17:01:31 UTC
JSP CUSTOM TAGS
Hello all,
Can anyone show me an example of accesing a session variable in a custom
tag?
Or at least point me towards documentation that explains it?
(I have an object that I store in a session variable, I need to retrieve in
one of my custom tags)
----------------------------------------------------------
Peter Giannopoulos, Software Designer
Gemplus Software, Advanced Projects Group
Phone: +15147322434
Fax: +15147322401
Gemplus Canada Inc., Http://www.gemplus.com
I hear and I forget,
I see and I remember,
I do and I understand.
-----------------------------------------------------------
Re: JSP CUSTOM TAGS
Posted by Anne Dirkse <al...@uswest.net>.
Peter --
All that you need to do is get your PageContext, then call getSession()
on that. Then you've got your session and can retrieve stuff from it.
Here's some pseudo-code to explain:
private PageContext pageContext;
public void setPageContext(PageContext pageContext) {
this.pageContext = pageContext;
}
public int doStartTag() throws JspException {
HttpSession session = pageContext.getSession();
Object objTarget = session.getAttribute(target);
return SKIP_BODY;
}
public void release() {
pageContext = null;
}
Hope that helps...
Anne
Peter Giannopoulos wrote:
>
> Hello all,
>
> Can anyone show me an example of accesing a session variable in a custom
> tag?
> Or at least point me towards documentation that explains it?
>
> (I have an object that I store in a session variable, I need to retrieve in
> one of my custom tags)
>
> ----------------------------------------------------------
> Peter Giannopoulos, Software Designer
> Gemplus Software, Advanced Projects Group
>
> Phone: +15147322434
> Fax: +15147322401
> Gemplus Canada Inc., Http://www.gemplus.com
>
> I hear and I forget,
> I see and I remember,
> I do and I understand.
>
> -----------------------------------------------------------
Re: JSP CUSTOM TAGS
Posted by Sam Newman <sa...@stamplets.com>.
The taglib sutff provided by the apache taglib project can do this - I think
there is one specifically for session information retrieval. Check the
taglibs project on the apache.org webpage.
sam
----- Original Message -----
From: "Peter Giannopoulos" <Pe...@gemplus.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, May 31, 2001 4:01 PM
Subject: JSP CUSTOM TAGS
> Hello all,
>
> Can anyone show me an example of accesing a session variable in a custom
> tag?
> Or at least point me towards documentation that explains it?
>
> (I have an object that I store in a session variable, I need to retrieve
in
> one of my custom tags)
>
>
> ----------------------------------------------------------
> Peter Giannopoulos, Software Designer
> Gemplus Software, Advanced Projects Group
>
> Phone: +15147322434
> Fax: +15147322401
> Gemplus Canada Inc., Http://www.gemplus.com