You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Raj Sidh <ra...@yahoo.com> on 2007/04/26 23:12:39 UTC

Cannot use applicationScope

Hello,

I am a newbie running Apache Tomcat/5.5.20.

My web.xml has these entries:

<context-param>
  <param-name>EmailId</param-name>
  <param-value>myname@company.com</param-value>
</context-param>
	
<servlet>
  <servlet-name>Test JSP</servlet-name>
  <jsp-file>/testjsp.jsp</jsp-file>
</servlet>


I have this in testjsp.jsp:

<html>
<body>
PLEASE CONTACT: ${applicationScope.EmailId}
<br>
More contact: <%=
application.getAttribute("EmailId")%>
</body>
</html>

BUT, I don't get these values ("EmailId") on the web
page that is output. But I can see from the servlet
generated, the automatic object, - "application", is
initialized. (Also I am not doing ELignore explcitly
anywhere). I cannot figure out what am I doing wrong
or I am not looking in right reference places. Please
help.

Thanks in advance.

Regards
Raj


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Cannot use applicationScope

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Raj,

Raj Sidh wrote:
> I am a newbie running Apache Tomcat/5.5.20.
> 
> My web.xml has these entries:
> 
> <context-param>

[snip]

> application.getAttribute("EmailId")

You are confusing these types of values. In web.xml, you are configuring
/context/ parameters, while you are attempting to read application (or
context) attributes in your JSP.

In order to access the values configured using <context-param>, you need
to call application.getInitParameter() instead of
application.getAttribute().

Hope that helps.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGMR6j9CaO5/Lv0PARAtvfAKC9XO9nNjiLw5T0n+UaVstPA7xsawCfQekz
hi5t56h+VjHOItMabtm3rvw=
=cP5g
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org