You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Adrian Beech <a....@bigpond.net.au> on 2004/09/12 11:32:08 UTC

[JSTL] Exposing defined elements in a JSP

G'day all,

I have a context parameter defined in the web.xml file and was wondering how
to get it into the JSP?  For example, I have
"<CONTEXT-PARAM><PARAM-NAME>applicationName</PARAM-NAME><PARAM-VALUE>RASCAL
- Development</PARAM-VALUE></CONTEXT-PARAM>" in the web.xml and
"<TITLE><c:out value='${initParams["applicationName"]}'/></TITLE>" in the
JSP.  The resulting HTML yields "<TITLE></TITLE>".

Have I misinterpreted something here?  I have tried both standard 1.0 and
1.1 under Tomcat 4.1.24 and 5.0.28 with the same results.

I would greatly appreciate it someone could steer me in the right direction.

AB



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


Re: [JSTL] Exposing defined elements in a JSP

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Adrian Beech wrote:

> Is initParam[...] JSTL 1.1 specific?  I can get <TITLE><c:out
> value='${initParam["applicationName"]}'/></TITLE> to work under Tomcat 5.0
> with JSTL 1.1 but not under Tomcat 4.1.24 with JSTL 1.0.

Nope, both of the below work fine on my 4.1.30 systems.

>     <c:out value='${initParam["applicationName"]}'/>
> or
>     <c:out value='${initParam.applicationName}'/>

Make sure you're using the appropriate web.xml for each version...

-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



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


RE: [JSTL] Exposing defined elements in a JSP

Posted by Adrian Beech <a....@bigpond.net.au>.
Hi,

Is initParam[...] JSTL 1.1 specific?  I can get <TITLE><c:out
value='${initParam["applicationName"]}'/></TITLE> to work under Tomcat 5.0
with JSTL 1.1 but not under Tomcat 4.1.24 with JSTL 1.0.

AB


-----Original Message-----
From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
Sent: Monday, 13 September 2004 1:16 AM
To: Tag Libraries Users List
Subject: Re: [JSTL] Exposing <CONTEXT-PARAM> defined elements in a JSP


Adrian Beech wrote:

> "<TITLE><c:out value='${initParams["applicationName"]}'/></TITLE>"

... it's initParam -- singular --

    <c:out value='${initParam["applicationName"]}'/>
or
    <c:out value='${initParam.applicationName}'/>

HTH,
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



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


__________ NOD32 1.868 (20040910) Information __________

This message was checked by NOD32 antivirus system. http://www.nod32.com



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


Re: [JSTL] Exposing defined elements in a JSP

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Adrian Beech wrote:

> "<TITLE><c:out value='${initParams["applicationName"]}'/></TITLE>" 

... it's initParam -- singular --

    <c:out value='${initParam["applicationName"]}'/>
or
    <c:out value='${initParam.applicationName}'/>

HTH,
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



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


Re: [JSTL] Exposing defined elements in a JSP

Posted by Dima Gutzeit <di...@mailvision.net>.
The following will work on 1.1:
<c:out value='<%=
config.getServletContext().getInitParameter("applicationName") %>'/>


I know that it is not that elegant, but it works :-)


----- Original Message ----- 
From: "Adrian Beech" <a....@bigpond.net.au>
To: <ta...@jakarta.apache.org>
Sent: Sunday, September 12, 2004 12:32
Subject: [JSTL] Exposing <CONTEXT-PARAM> defined elements in a JSP


G'day all,

I have a context parameter defined in the web.xml file and was wondering how
to get it into the JSP?  For example, I have
"<CONTEXT-PARAM><PARAM-NAME>applicationName</PARAM-NAME><PARAM-VALUE>RASCAL
- Development</PARAM-VALUE></CONTEXT-PARAM>" in the web.xml and
"<TITLE><c:out value='${initParams["applicationName"]}'/></TITLE>" in the
JSP.  The resulting HTML yields "<TITLE></TITLE>".

Have I misinterpreted something here?  I have tried both standard 1.0 and
1.1 under Tomcat 4.1.24 and 5.0.28 with the same results.

I would greatly appreciate it someone could steer me in the right direction.

AB



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




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