You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrzej Bengner <an...@e-direct.pl> on 2005/11/04 12:25:52 UTC

TagSupport - how to get request attribute

Hello,

I have one problem with access to attribute in request in my class from 
TagSupport.
I send GET to my site (eg. http://localhost/app/site.jsp?Test=value). 
How to get this "Test" attribute in my class?

I tried:

TagUtils.getInstance().lookup(pageContext,"Test", null);
pageContext.findAttribute("Test");

ServletRequest request = pageContext.getRequest();
request.getAttribute("Test");

... and all of this returns null.

Regards

-- 
Andy


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


Re: TagSupport - how to get request attribute

Posted by Martin Gainty <mg...@hotmail.com>.
Andrei-

This is straight from the doc!
*This assumes you have configured your backing bean*

  * @param pageContext Page context to be searched
954      * @param name Name of the bean to be retrieved
955      * @param scopeName Scope to be searched (page, request, session, 
application)
956      *  or <code>null</code> to use <code>findAttribute()</code> instead
957      * @return JavaBean in the specified page context
958      * @exception JspException if an invalid scope name
959      *  is requested
960      */
961     public Object lookup(PageContext pageContext, String name, String 
scopeName)

dobranoc,
Martin-

----- Original Message ----- 
From: "Andrzej Bengner" <an...@e-direct.pl>
To: <us...@struts.apache.org>
Sent: Friday, November 04, 2005 6:25 AM
Subject: TagSupport - how to get request attribute


> Hello,
>
> I have one problem with access to attribute in request in my class from 
> TagSupport.
> I send GET to my site (eg. http://localhost/app/site.jsp?Test=value). How 
> to get this "Test" attribute in my class?
>
> I tried:
>
> TagUtils.getInstance().lookup(pageContext,"Test", null);
> pageContext.findAttribute("Test");
>
> ServletRequest request = pageContext.getRequest();
> request.getAttribute("Test");
>
> ... and all of this returns null.
>
> Regards
>
> -- 
> Andy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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