Jsp Gurus,
I trying to do user authentication by using a java class called
Administrator in my jsp. I need to attach this object to the session so i
can check on each page if this is not null and so the page can be viewed
else send them to the login page.
The code is
<%@ page language="java" import="myBeans.*" %>
<jsp:useBean id="auth" scope="page" class="myBeans.ValidateAdmin" />
<jsp:setProperty name="auth" property="*"/>
<%! String display;
%>
<%
display = "launch.jsp";
try
{
Administrator admin = auth.authenticate();
// check if the user is allowed to view the next page
if (admin != null)
{
out.println("The admin is not null");
session.setAttribute ("administrator",admin);
}
%>
<jsp:include page="nextpage.jsp" />
<%
}
catch (Exception e){}
%>
It works fine till i add the line
session.setAttribute() to add the object in the session. When i do that i
get the following error
Fri Jul 14 13:50:45 EDT 2000:<E> <ServletContext-General> Compilation of
D:\webl
ogic\myserver\classfiles\jsp_servlet\_htdocs\_login3\_logonadministrator.java
fa
iled:
D:\weblogic\myserver\classfiles\jsp_servlet\_htdocs\_login3\_logonadminist
rator.java:122: cannot resolve symbol
symbol : method setAttribute (java.lang.String,myBeans.Administrator)
location: interface javax.servlet.http.HttpSession
session.setAttribute ("administrator",admin); //[
/htdocs/lo
gin3/logonAdministrator.jsp; Line: 22]
^
---------------------------------------
Thanks for the help!
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
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