You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Werner Guttmann <We...@morganstanley.com> on 2002/08/16 16:26:08 UTC

XSP logicsheet for the ServletContext object

Hi,

just looking at the available XSP logicsheets, it seems that there is
not a logicsheet for the ServletContext that would offer the kind of
functionality the request logicsheet offers for interacting with the
HttpServletRequest. If that's true, how does one access e.g. context
parameters of the web app from within an XSP page ?

Werner




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: XSP logicsheet for the ServletContext object

Posted by Per Kreipke <pe...@onclave.com>.
I just noticed that class XSPUtil (the implementing class for util taglib)
has the following function, which also shows how to get context info in
Java:

public static Object getContextAttribute(Map objectModel, String name)
{
	Context context = ObjectModelHelper.getContext(objectModel);
	return context.getAttribute(name);
}

In XSP (assuming XSPUtil class is already imported):


<xsp:logic>
	// objectModel is already a local var available to your XSP
	String attr = XSPUtil.getContextAttribute(objectModel, "foo");

	// If you want this for anything else....
	Context context = ObjectModelHelper.getContext(objectModel);
</xsp:logic>

<debug><xsp:expr>context.getAttribute("bar")</xsp:expr></debug>



Per


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSP logicsheet for the ServletContext object

Posted by Vadim Gritsenko <va...@verizon.net>.
Werner Guttmann wrote:

>Hi,
>
>just looking at the available XSP logicsheets, it seems that there is
>not a logicsheet for the ServletContext that would offer the kind of
>functionality the request logicsheet offers for interacting with the
>HttpServletRequest. 
>

They (context parameters) are not that popular.


>If that's true, how does one access e.g. context
>parameters of the web app from within an XSP page ?
>

Either by writing a logicsheet (and donating it back) or by using plain 
Java in XSP, which is still possible ;)

Vadim


>Werner
>  
>




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>