----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

on 3/24/00 8:13 PM, Sudheer Divakaran <[EMAIL PROTECTED]> wrote:

> HttpSession oSession=oRequest.getSession(false);

the problem is that you set this to false. set it to true and your problem
goes away (i tested this and it works for me)...except your code doesn't
compile the first time because you have a missing "s" variable...

here is your code with a couple minor fixes...i just tested it with Apache
JServ 1.1 and Apache 1.3.9 and it works just fine...

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class test extends HttpServlet
{
  public void service(HttpServletRequest oRequest,HttpServletResponse
oResponse) throws IOException
  {
      PrintWriter oWriter=oResponse.getWriter();
  HttpSession oSession=oRequest.getSession(true);
  oResponse.setContentType("text/html");
  String sTemp =null;
 oWriter.print("<html>");
 if(oSession!=null)
  {
   sTemp=(String)oSession.getValue("abc");
   oSession.putValue("abc","1");
  }
  else
  {
   oWriter.print("Session=null");
  }
  oWriter.print("<br><a href=\"" + oResponse.encodeUrl("test") + "\">foo</a>
" + sTemp +"<br></html>");
  oWriter.close();
  }
}

next time, before blaming someone else, try blaming yourself first. :-)

p.s. please don't cc me on replies...i'm already subscribed to this list and
i don't need duplicate emails...

-jon



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to