Re: Problem with jsp pages
Hi Antonio, The way you wrote it right now, getServletContext() should be a method of your current jsp and it isn't. That's what the error is telling you. The correct way to access the servlet context is to use the implicit object 'application'. This is a predefined variable in every jsp. For a complete list of these implicit objects, see the jsp 1.1 specification, section 2.8. It's at orion\docs\jsp\jsp1_1-spec.pdf Good luck, Marcel - Original Message - From: Antonio Vazquez [EMAIL PROTECTED] To: Orion-Interest [EMAIL PROTECTED] Sent: Friday, June 01, 2001 9:39 AM Subject: Problem with jsp pages Hi all, I'm a newbie using Orion and I have a problem. I need to get Servlet Context to get an attribute, but when I use getServletContext().getAttribute(Attribute) I receive the follow error: /jsp/adestadoc.jsp.java:35: Method getServletContext() not found in class /jsp/adestadoc.jsp. (JSP page line 9) Vector vectorUsuarios = (Vector)getServletContext().getAttribute(vu); I've put tools.jar and rt.jar in the Orion directory. I haven´t any other problems executing servlets and jsp pages. Can anybody help me? Thanks in advance. Antonio
RE: Problem with jsp pages
Instead of the spec, I have the the JSP Syntax charts posted to my bulletin board...it has all of these nice shortcuts on two sheets of paper: http://java.sun.com/products/jsp/pdf/card11.pdf or the more lengthy version: http://java.sun.com/products/jsp/tags/11/syntaxref11.html regards, the elephantwalker -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Marcel Schutte Sent: Friday, June 01, 2001 1:50 AM To: Orion-Interest Subject: Re: Problem with jsp pages Hi Antonio, The way you wrote it right now, getServletContext() should be a method of your current jsp and it isn't. That's what the error is telling you. The correct way to access the servlet context is to use the implicit object 'application'. This is a predefined variable in every jsp. For a complete list of these implicit objects, see the jsp 1.1 specification, section 2.8. It's at orion\docs\jsp\jsp1_1-spec.pdf Good luck, Marcel - Original Message - From: Antonio Vazquez [EMAIL PROTECTED] To: Orion-Interest [EMAIL PROTECTED] Sent: Friday, June 01, 2001 9:39 AM Subject: Problem with jsp pages Hi all, I'm a newbie using Orion and I have a problem. I need to get Servlet Context to get an attribute, but when I use getServletContext().getAttribute(Attribute) I receive the follow error: /jsp/adestadoc.jsp.java:35: Method getServletContext() not found in class /jsp/adestadoc.jsp. (JSP page line 9) Vector vectorUsuarios = (Vector)getServletContext().getAttribute(vu); I've put tools.jar and rt.jar in the Orion directory. I haven´t any other problems executing servlets and jsp pages. Can anybody help me? Thanks in advance. Antonio
Re: Problem with jsp pages
try: request.getAttribute(STH); page.getServletContext().getAttribute(STH); in JSP pages you have severial classes such page, request, session from them you have access to what you want. - Original Message - From: Antonio Vazquez [EMAIL PROTECTED] To: Orion-Interest [EMAIL PROTECTED] Sent: Friday, June 01, 2001 9:39 AM Subject: Problem with jsp pages Hi all, I'm a newbie using Orion and I have a problem. I need to get Servlet Context to get an attribute, but when I use getServletContext().getAttribute(Attribute) I receive the follow error: /jsp/adestadoc.jsp.java:35: Method getServletContext() not found in class /jsp/adestadoc.jsp. (JSP page line 9) Vector vectorUsuarios = (Vector)getServletContext().getAttribute(vu); I've put tools.jar and rt.jar in the Orion directory. I haven´t any other problems executing servlets and jsp pages. Can anybody help me? Thanks in advance. Antonio
Re: Problem with jsp pages
Hi. I guess by the err log, that you are trying to use this method in a JSP page. As by the specs in a JSP to get a reference to the cotext you should use the "pageContext" object, that is found in every JSP page. Why not give it a try? TRY: Vector vectorUsuarios = (Vector)pageContext.getAttribute("vu"); pageContext is an object of type javax.servlet.jsp.PageContext. There is also one implicit object: "application". It should be of type javax.servlet.ServletContext. So you can also try: Vector vectorUsuarios = (Vector)application.getAttribute("vu"); BTW. Your problem is the getServletContext method, not the getAttribute :) Hope this helps. May the shade of the tree strengthen you. Lachezar Hi all, I'm a newbie using Orion and I have a problem. I need to get Servlet Context to get an attribute, but when I use getServletContext().getAttribute("Attribute") I receive the follow error: /jsp/adestadoc.jsp.java:35: Method getServletContext() not found in class /jsp/adestadoc.jsp. (JSP page line 9) Vector vectorUsuarios = (Vector)getServletContext().getAttribute("vu"); I've put tools.jar and rt.jar in the Orion directory. I haven´t any other problems executing servlets and jsp pages. Can anybody help me? Thanks in advance. Antonio