Topic: javax.servlet.http.HttpSession interface - setAttribute and getAttribute

Development Environment:
I am running Inprise Server 4.0 (which accesses it's ias.jar dated 2/16/00) as
distributed with JBuilder 3.5 Enterprise.
I have set up JBuilder to access JDK 1.3, j2sdkee 1.2.1's (j2ee.jar dated
4/27/00) and jswdk-1.0.1's (jspengine.jar and servlet.jar)

Two Problem(s):
This identical code listed below compiles and runs fine on the J2EE distributed
server (based on Tomcat)
a) could these problems be due to version differences between the jar files (IAS
vs J2EE)?
b) any suggested methods to attack this issue (other than drop the Inprise
server)
Thanks for your time and consideration!

1) In a login servlet, I use setAttribute (instead of the deprecated putValue).
The setAttribute command compiles under JBuilder without an error.  However,
when I run this servlet using the Inprise server (http://localhost...) I receive
the following exception:

javax.servlet.http.HttpSession: method
setAttribute(Ljava/lang/String;Ljava/lang/Object;)V not found.

++ Second related problem
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2) In a JSP (which is called from within this login servlet using a
RequestDispatcher command), I try to access a variable "usr" via the following:

       session = request.getSession();
       user us = (user) session.getAttribute("usr");

When I test the JSP using the Inprise server I receive the following exception:
++++++++++++++++++++++++++++++++++++++++++++++++
Java Server Page Translation Error
Error during compilation :

D:\Java\Inprise\AppServer\tmpdir\default\pagecompile\jsp\_jsp\_PageHolder.java:86:

cannot resolve symbol
symbol  : method getAttribute  (java.lang.String)
location: interface javax.servlet.http.HttpSession
                   user us = (user) session.getAttribute("usr");
                                                                 ^
+++++++++++++++++++++++++++++++++++++++++++++++
When I compile the JSP's generated servlet source code using JBuilder and then
test the JSP using the Inprise server I receive the following exception:

java.lang.NoSuchMethodError: javax.servlet.http.HttpSession: method
getAttribute(Ljava/lang/String;)Ljava/lang/Object;

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to