getServletContext() returns "/" for default context defined outside of server.xml

2005-07-22 Thread Martin Bromley
". This is all working fine, apart from one issue: a call to HttpServletRequest.getServletContext() returns "/" rather than "" - the servlet API says "" is correct . If the default context is defined in server.xml, getServletContext() returns "" a

Re: RequestDispatcher and getServletContext() don't work when using init()

2003-10-15 Thread Tim Funk
You must call super.init(...) in your init method. -Tim Luke Vanderfluit wrote: Hi, I found that using the init() method to set up a database connection then trying to instantiate a ServletContext object and forward to a jsp page didn't work. If placed the database connection code in the doPo

RequestDispatcher and getServletContext() don't work when using init()

2003-10-15 Thread Luke Vanderfluit
etParameter("descr"); try { // Declare statement Statement statement = dbcon.createStatement(); String query = "insert into bookmark values('" + title + "', '" + url + "', '" + descr + "'

Re: getServletContext call from jsp page...

2002-10-11 Thread Tim Funk
n from below. Padhu Vinirs wrote: > > Wanted to know if this assumption is valid in most jsp containers: > > Is calling getServletContext() ( instead of > getServletConfig().getServletContext() ) assuming that the servlet > generated from the jsp will be derived from HttpS

getServletContext call from jsp page...

2002-10-11 Thread Padhu Vinirs
Wanted to know if this assumption is valid in most jsp containers: Is calling getServletContext() ( instead of getServletConfig().getServletContext() ) assuming that the servlet generated from the jsp will be derived from HttpServlet ? This works ( in Tomcat ) because HttpJspBase derives

Portabilty concern for getServletContext (was Re: ??? Tomcat Bug? -- Throws NullPointerException ???)

2002-07-18 Thread Will Hartung
."); > ois.defaultReadObject(); > System.out.println("defaultReadObject completed..."); > ServletContext sc = getServletContext(); // BOOM!! > System.out.println("Got the servlet context!!!"); > } // readObject() >} // Inner I j

RE: getServletContext() error

2002-04-17 Thread Jeff Macomber
Please ignore the previous message I found the problem and it was just a mistake on my side. -Original Message- From: Jeff Macomber [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 5:39 PM To: 'Tomcat Users List' Subject: getServletContext() error Hi all, I am

getServletContext() error

2002-04-17 Thread Jeff Macomber
Hi all, I am trying to share an object from a servlet to a JSP by using the getServletContext().setAttribute() method in the init() of my servlet. I am able to return the context from the JSP page but am unable to retrieve the attribute (getAttribute() returns null). I have setup the Context

Re: getServletContext() returning null...

2002-01-14 Thread G Winstanley
On Mon, 14 Jan 2002 09:59:49 -0500 you wrote: > The easiest way to get this behavior is to override > init(ServletConfig config) in your servlet and forget > to call super.init(config) as instructed in the Javadoc. > You can either call super.init(config), or override > init() instead, which is c

RE: getServletContext() returning null...

2002-01-14 Thread Larry Isaacs
> -Original Message- > From: Stan [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 14, 2002 9:39 AM > To: [EMAIL PROTECTED] > Subject: getServletContext() returning null... > > > I have a servlet in which I am trying to pass control to a JSP page to > conform with the

getServletContext() returning null...

2002-01-14 Thread Stan
to dispatch the request over to the JSP I get null back from the getServletContext() call. Is there anything in the configuration I have supplied which would stop this context being created appropriately? I would presume that a servlet would necessarily be part of a ServletContext, and therefore it

Re: getServletContext() throws NullPoinetException - solved

2001-07-10 Thread Stefanos Karasavvidis
found it... I didn't call super.init(config) in the init() method sorry Stefanos Stefanos Karasavvidis wrote: > I've just installed tomcat 3.2.2 and have the following problem. > > I want to call getServletContext() from a servlets service method but > get the folowing

RE: getServletContext() throws NullPoinetException

2001-07-10 Thread William Kaufman
sure to call the superclass' init() method? -- Bill K. > -Original Message- > From: Stefanos Karasavvidis [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 10, 2001 7:46 AM > To: [EMAIL PROTECTED] > Subject: getServletContext() t

RE: getServletContext() throws NullPoinetException

2001-07-10 Thread Vladimir Grishchenko
Did you override init(ServletConfig config) method? YOu must call super(config) if you did... --V. -Original Message- From: Stefanos Karasavvidis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 7:46 AM To: [EMAIL PROTECTED] Subject: getServletContext() throws NullPoinetException

RE: getServletContext() throws NullPoinetException

2001-07-10 Thread Randy Layman
[EMAIL PROTECTED] > Subject: getServletContext() throws NullPoinetException > > > I've just installed tomcat 3.2.2 and have the following problem. > > I want to call getServletContext() from a servlets service method but > get the folowing exception > *Internal Servl

getServletContext() throws NullPoinetException

2001-07-10 Thread Stefanos Karasavvidis
I've just installed tomcat 3.2.2 and have the following problem. I want to call getServletContext() from a servlets service method but get the folowing exception *Internal Servlet Error:* java.lang.NullPointerException at javax.servlet.GenericServlet.getServletCo

RE: getServletContext()

2001-06-27 Thread Stefan Neumann
Hi, getAttribute returns a java.lang.Object so you have to cast it to java.sql.Connection. You will also need to import java.sql. <%@ page import="java.sql.*" %> ... <% Connection Conn = (Connection)getServletContext().getAttribute("dbConnection"); %> Make sure

Re: getServletContext()

2001-06-26 Thread anil
I guess to save any object to a session, the object has to implement serializable interface. anil

Re: getServletContext()

2001-06-26 Thread Krishna Muthyala
ass it > to the ServletContext like > this. > > getServletContext().setAttribute("dbConnection",dbConnection); > > Now the problem is how do I retrieve it from a jsp > page. From by research, > reading through books it shows how to get an > attribute using :

getServletContext()

2001-06-26 Thread JeremyRayYoo
Hi, I have a problem I have been trying to solve for a very long time. I first have a initialization servlet set by tag. In this servlet I create a database connection and pass it to the ServletContext like this. getServletContext().setAttribute("dbConnection",dbConnection); Now t

RE: getServletContext null pointer exception

2001-03-13 Thread Milt Epstein
<% out.print(i); %> > <% out.print(aResult.elementAt(i)); %> > > <% } %> > > > > > > > -Original Message- > > From: Milt Epstein [SMTP:[EMAIL PROTECTED]] > > Sent: Tuesday, March 13, 2001 3:27 PM >

RE: getServletContext null pointer exception

2001-03-13 Thread labrensz
<% } %> > -Original Message- > From: Milt Epstein [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, March 13, 2001 3:27 PM > To: [EMAIL PROTECTED] > Subject: RE: getServletContext null pointer exception > > On Tue, 13 Mar 2001 [EMAIL PROTECTED] wrote:

RE: getServletContext null pointer exception

2001-03-13 Thread Milt Epstein
On Tue, 13 Mar 2001 [EMAIL PROTECTED] wrote: > Yup, the jsp is in webapps/jdbctut/jdbctut.jsp > > This is where i get the err. > > if i use this stmt. > ==> String value = getServletContext().getInitParameter("dbuser"); > > or if i use this stmt > =

RE: getServletContext null pointer exception

2001-03-13 Thread labrensz
Yup, the jsp is in webapps/jdbctut/jdbctut.jsp This is where i get the err. if i use this stmt. ==> String value = getServletContext().getInitParameter("dbuser"); or if i use this stmt ==> System.out.println(getServletConfig().getServletContext().getInitParameter or if i

RE: getServletContext null pointer exception

2001-03-13 Thread Milt Epstein
; -Original Message- > > From: Milt Epstein [SMTP:[EMAIL PROTECTED]] > > Sent: Saturday, March 10, 2001 9:26 AM > > To: [EMAIL PROTECTED] > > Subject:Re: getServletContext null pointer exception > > > > On Fri, 9 Mar 2001 [EMAIL PROTECTED] wro

RE: getServletContext null pointer exception

2001-03-13 Thread labrensz
age- > From: Milt Epstein [SMTP:[EMAIL PROTECTED]] > Sent: Saturday, March 10, 2001 9:26 AM > To: [EMAIL PROTECTED] > Subject: Re: getServletContext null pointer exception > > On Fri, 9 Mar 2001 [EMAIL PROTECTED] wrote: > > > Hi, > > > > I have been

Re: getServletContext null pointer exception

2001-03-10 Thread Milt Epstein
ing connect() { > try { >Class.forName("com.informix.jdbc.IfxDriver").newInstance(); >return "Driver Loaded!"; > } catch (Exception E) { >return "Unable to load driver."; > } >} > >public String select() { > //S

getServletContext null pointer exception

2001-03-09 Thread labrensz
{ return "Unable to load driver."; } } public String select() { // String value = getServletContext().getInitParameter("dbuser"); // System.out.println(getServletConfig().getServletContext().getInitParameter(" dbuser")); ServletConfig sc = getSe

Re: getServletContext() returns nullpointer-exception

2000-12-08 Thread andreas ebbert
On Thu, 07 Dec 2000 19:15:47 -0600, William Brogden wrote: > > >andreas ebbert wrote: >> >> Hi, >> I am trying to get a servlets context >> with getServletContext() but all I get >> is a NullPointerException. Can anybody >> help me? >> >>

Re: getServletContext return nullpointer-exception

2000-12-07 Thread William Brogden
andreas ebbert wrote: > > Hi, > I am trying to get a servlets context > with getServletContext() but all I get > is a NullPointerException. Can anybody > help me? > > greetings, > Andreas The usual reason for this is a failure to call super.init() in your servlet

getServletContext return nullpointer-exception

2000-12-07 Thread andreas ebbert
Hi, I am trying to get a servlets context with getServletContext() but all I get is a NullPointerException. Can anybody help me? greetings, Andreas --- Andreas Ebbert, Kuthstrasse 43, 51107 Koeln e-mail: [EMAIL PROTECTED] Fon