You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Venkat Dosapati <ve...@translogicsys.com> on 2000/04/12 18:34:33 UTC

problem with pageContext.

Dear Tomcat users,
                using pageContext.setAttribute(String, Object), i registered
objects in HashTable.  when i get that object using
pageContext.getAttribute(String), i could not get the object. it is giving
null. it is not throwing any exception. please help me.
-venkat.
-----Original Message-----
From: Craig R. McClanahan <Cr...@eng.sun.com>
To: tomcat-user@jakarta.apache.org <to...@jakarta.apache.org>
Date: Wednesday, April 12, 2000 10:47 PM
Subject: Re: problem with taglib


>One thing I'm pretty sure changed between 3.1beta1 and 3.1rc1 is to use a
>validating XML parser call, rather than non-validating.  This will require
a
>valid declaration at the top of your tag library descriptor file.  I use
the
>following (as does the example TLD in
>webapps/examples/WEB-INF/jsp/example-taglib.tld):
>
>    <!DOCTYPE taglib
>        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
>        "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
>
>Could people experiencing this problem please try this and report back?
>
>Craig McClanahan
>
>
>Piotr Lipski wrote:
>
>> Hello!
>>
>> I've jsp page with custom tags in it. The page used to work in tomcat 3.1
>> beta release now its not (using 4/11 nightly release). Can someone help
me
>> solve the problem?
>> I'm running tomcat on Win NT with JDK 1.3RC2
>>
>> PL
>>
>> taglib directive in jsp page:
>>
>> <%@ taglib uri="/tfconline" prefix="cafa" %>
>>
>> web.xml:
>>
>> <taglib>
>>     <taglib-uri>/tfconline</taglib-uri>
>>     <taglib-location>/tlds/tfconline.tld</taglib-location>
>> </taglib>
>>
>> exception:
>>
>> org.apache.jasper.JasperException: Unable to open taglibrary /tfconline :
>> Parse Error in the tag library descriptor: com.sun.xml.parser/V-036
servlet
>> init-param
>>  at
>>
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
>> ntListener.java:672)
>>  at
>>
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
>> ener.java:116)
>>  at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
>>  at org.apache.jasper.compiler.Parser.parse(Parser.java:1073)
>>  at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
>>  at org.apache.jasper.compiler.Parser.parse(Parser.java:1034)
>>  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182)
>>  at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
>>  at
>>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
>> rvlet.java:149)
>>  at
>>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
>> va:161)
>>  at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
>>  at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>>  at
>>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:502)
>>  at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>>  at
>>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
>> onnectionHandler.java:160)
>>  at
>>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
>> )
>>  at java.lang.Thread.run(Unknown Source)
>>
>> -------------------------------------------------------------------------
-
>> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
>
>
>
>--------------------------------------------------------------------------
>To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
>


Re: problem with pageContext.

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Venkat Dosapati wrote:

> Dear Tomcat users,
>                 using pageContext.setAttribute(String, Object), i registered
> objects in HashTable.  when i get that object using
> pageContext.getAttribute(String), i could not get the object. it is giving
> null. it is not throwing any exception. please help me.

This kind of stuff has worked fine for me.  The getAttribute method is supposed
to return null, not an exception, if it doesn't find a value with the key you
specified.  Two things to look at:

* Are you sure that the string values you used in the
  setAttribute() and getAttribute() calls are identical?

* Are you doing these two calls in the same JSP page?
  (The two-argument version of setAttribute() puts your
  object into page scope, so it won't be there if you try to
  access it from a different page.)

If these two issues are not causing your problem, please try to post an example
test case where it's not working.

> -venkat.

Craig McClanahan





Re: problem with pageContext.

Posted by Christopher Stacy <cs...@crystaliz.com>.
>>>>> On Wed, 12 Apr 2000 22:04:33 +0530, Venkat Dosapati ("Venkat") writes:
 Venkat> using pageContext.setAttribute(String, Object), i registered
 Venkat> objects in HashTable.  when i get that object using
 Venkat> pageContext.getAttribute(String), i could not get the object. it is giving
 Venkat> null. it is not throwing any exception. please help me.

The pageContext is released once the response is sent back to the client.
Perhaps you wanted to store into the application or session context instead.