LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   JSP context object not found (https://www.linuxquestions.org/questions/programming-9/jsp-context-object-not-found-365638/)

poeta_boy 09-21-2005 11:58 AM

JSP context object not found
 
Hello:

I have an app in tomcat, and having the following web.xml:

Code:

  <context-param>
            <param-name>database</param-name>
            <param-value>jdbc:mysql://localhost:3306/dsstdicne05</param-value>
  </context-param>         
   
    <context-param>
            <param-name>driver</param-name>
          <param-value>com.mysql.jdbc.Driver</param-value>
  </context-param>

And I try to use it in a JSP:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=iso-8859-1"
        pageEncoding="ISO-8859-1"%>
<%@ page session="true"%>
<jsp:useBean id="bd" class="variables.BD" scope="session" />
<%
        System.out.println("*****Obteniendo datos del ServletContext");
               
        String login = (String)context.getInitParameter("login");
       
%>

But I get the error:
Code:


cannot resolve symbol
symbol  : variable context
location: class org.apache.jsp.InicioS_jsp
        String login = (String)context.getInitParameter("login");
                              ^
1 error

I thought context was an implicit object in a JSP, but it says it's not there...

any ideas?

Thanks

Poeta

poeta_boy 09-21-2005 01:06 PM

Solved it... I used application.getParameter instead


All times are GMT -5. The time now is 11:28 PM.