• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

initParam for EL not working

 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have run examples of EL before in my tomcat 5. So, not sure why initParam is not working. Here is my code and web.xml. The header and footer appears properly.

Contact.jsp

<html>
<body>
<%@ include file="Header.jspf" %>
<em> We can help <br><br></em>
Contact us at : ${initParam.mainEmail}
The context param in jsp using scrpting is :<%= application.getInitParameter("mainEmail") %>

<%@ include file="Footer.jsp" %>
</body>
</html>


My web.xml file

!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<context-param>
<param-name>mainEmail</param-name>
<param-value> likeWeCare@wickedlysmart.com</param-value>
</context-param>


</web-app>


The result is printed as :


We know how to make SOAP suck less We can help

Contact us at : ${initParam.mainEmail}
The context param in jsp using scrpting is :likeWeCare@wickedlysmart.com THE FOOTER FILE


Why is the browser not recognising the initParam ? Thanks
 
Rodrigo W Bonatto
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

try changing this in web.xml:

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

to this:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">



Rodrigo

[ January 19, 2005: Message edited by: Rodrigo W Bonatto ]
[ January 19, 2005: Message edited by: Rodrigo W Bonatto ]
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rodrigo,
Thanks for the reply. I changed the DD in web.xml but its not working Any help is appreciated!
 
Rodrigo W Bonatto
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try deleting files in your $CATALINA_HOME/work/Catalina/localhost/yourApp

Restart your TomCat and it should resolv the problem.

Rodrigo
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool! It works! What exactly did I delete to make it work ? Thanks.
 
Rodrigo W Bonatto
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You deleted the generated code by the container.

You modified your web.xml but, I think the container didn't recognize the changes in the DD just refreshing your page.
So, you deleted the generated files forcing the container to recompile the jsp according with the changes you made in the web.xml

But it is what I guess. If I am wrong, somebody please clear my mind.

Thanks,

Rodrigo
[ January 20, 2005: Message edited by: Rodrigo W Bonatto ]
 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool! That makes sense. Thanks a lot!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic