Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JSP Interest »

Re: Taglib / context-param question

Karr, David

2005-02-09


Assuming your question is:

How do I replace the hard-coded value of "#EEEEFF" in my "doEndTag()"
method with the code to read the init-param, then:

pageContext.getServletContext().getInitParam("color1")

> -----Original Message-----
> From: A mailing list about Java Server Pages specification
> and reference [mailto:JSP-INTEREST@(protected)
> Jack Lauman
> Sent: Wednesday, February 09, 2005 2:24 PM
> To: JSP-INTEREST@(protected)
> Subject: Taglib / context-param question
>
>
> I have the following code in a custom taglib. If I put the
> hex values of the colors in the context-param area of the
> web.xml file, how do you call them?
>
> <context-param>
>   <param-name>color1</param-name>
>   <param-value>#EEEEFF</param-value>
> </context-param>
> <context-param>
>   <param-name>color2</param-name>
>   <param-value>#CCCCFF</param-value>
> </context-param>
> ...
>
>
> public int doEndTag() throws JspException {
>
> Boolean alternate = (Boolean)
> ExpressionEvaluatorManager.evaluate("alternate", alternateEL,
> Boolean.class, this, pageContext);
>
>
> if (alternate.booleanValue()) {
>    color = "#EEEEFF";
> } else {
>    color = "#CCCCFF";
> }
>
> try {
>    JspWriter out = pageContext.getOut();
>    out.write(color);
>
>    } catch (IOException e) {
>       e.printStackTrace();
>    }
>
>    return EVAL_PAGE;
> }
>
> ==============================================================
> =============
> To unsubscribe: mailto listserv@(protected):
> "signoff JSP-INTEREST". For digest: mailto
> listserv@(protected)".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
> http://java.sun.com/products/jsp
> http://archives.java.sun.com/jsp-interest.html
> http://forums.java.sun.com
> http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto listserv@(protected)".
For digest: mailto listserv@(protected)".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com
©2008 junlu.com - Jax Systems, LLC, U.S.A.