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:[EMAIL PROTECTED] On Behalf Of 
> Jack Lauman
> Sent: Wednesday, February 09, 2005 2:24 PM
> To: [email 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 [EMAIL PROTECTED] with body: 
> "signoff JSP-INTEREST". For digest: mailto 
> [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> 
> 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 [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

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

Reply via email to