You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Didier McGillis <co...@hotmail.com> on 2005/02/01 21:56:14 UTC

getAttribute returning null

Having problem with a context parm.  I have a servlet that queries for 300+ 
list of names, it then builds a select list.  This list changes 
infrequently, the jsp page is supposed to display the data from the servlet, 
so being the absolutly brilliant person that I am I wanted that option list 
built on startup, and then just have the jsp display the list.

I retrofitted the servlet to build the list, and then put 
<%=application.getAttribute("listOfDealer")%> in the jsp, open the page and 
wham -o awesome, great .. it doesnt work, all I see is null.

any thoughts



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


Re: getAttribute returning null

Posted by QM <qm...@brandxdev.net>.
On Tue, Feb 01, 2005 at 08:56:14PM +0000, Didier McGillis wrote:
: Having problem with a context parm.  I have a servlet that queries for 300+ 
: list of names, it then builds a select list.  This list changes 
: infrequently, the jsp page is supposed to display the data from the 
: servlet, so being the absolutly brilliant person that I am I wanted that 
: option list built on startup, and then just have the jsp display the list.
: 
: I retrofitted the servlet to build the list, and then put 
: <%=application.getAttribute("listOfDealer")%> in the jsp, open the page and 
: wham -o awesome, great .. it doesnt work, all I see is null.

In addition to Tim Funk's advice, I'd suggest you post the code.  A
one-letter typo can cause all sorts of headaches =)

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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


Re: getAttribute returning null

Posted by Tim Funk <fu...@joedog.org>.
No idea. But since you are using application (aka the servlet context), try 
this to see whats in your ServletContext ...

<%
/* Yes - this is about to produce tables */
out.println("<table border='1'>");
out.println("<tr><th>Key</th><th>Value</th></tr>");
for (java.util.Enumeration e = application.getAttributeNames();
      e.hasMoreElements();) {
   Object key = e.nextElement();
   out.print("<tr>");
   out.print("<td>");
   out.print(key.toString());
   out.print("</td>");
   out.print("<td>");
   out.print(application.getAttribute(key).toString());
   out.print("</td>");
   out.print("</tr>");
}
out.println("</table>");
%>

-Tim

Didier McGillis wrote:
> Having problem with a context parm.  I have a servlet that queries for 
> 300+ list of names, it then builds a select list.  This list changes 
> infrequently, the jsp page is supposed to display the data from the 
> servlet, so being the absolutly brilliant person that I am I wanted that 
> option list built on startup, and then just have the jsp display the list.
> 
> I retrofitted the servlet to build the list, and then put 
> <%=application.getAttribute("listOfDealer")%> in the jsp, open the page 
> and wham -o awesome, great .. it doesnt work, all I see is null.
> 
> any thoughts


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