I am having a problem with Welcome.jsp not showing up. I have a servlet
which
checks user name and password in database. If validated, user will be
allowed to login either as administor or customer. If customer successfully
logs in,  Welcome.jsp should show up.  However, instead of displaying
Welcome.jsp, I got only a blank screen even though Welcome.jsp shows in URL.
Maybe a session problem?

Please help!

RD

//Here is Welcome.jsp

<% if ( session.getValue("logon.isDone") == null) { %>

        <B> error....<B>

<% // here we can give some error message %>

<% } else {%>

 <!------- so this is the authorized user let's display the welcome
 message --- >

<HTML>

 <HEAD>

<B> Welcome  <%= session.getValue("logon.isDone")%>

</B>

 </HEAD>

<BODY>

  <!--- all the other stuff -->

</BODY>

</ HTML>

<%  }   %>




//Here is the snippet of LoginHandler.java

if ((isLoggedIn1())||(isLoggedIn2())){
                 // Valid login.  Make a note in the session object.
      HttpSession session = req.getSession(true);
      session.setAttribute("logon.isDone", Name);  // just a marker object
         }

         if (isLoggedIn1()){
                out.println("<H3>hi...cust..</H3>");
                // Try redirecting the client to the page he first tried to access
        try {

        res.sendRedirect("/jsp/db_proj/Welcome.jsp");
         return;


        }
        catch (Exception ignored) { }

        // Couldn't redirect to the target.  Redirect to the site's home
page.
        res.sendRedirect(req.getScheme() + "://" +
                       req.getServerName() + ":" + req.getServerPort());


         } else if (isLoggedIn2()){
                out.println("<H3>hi...admin..</H3>");
        }else{
                out.println("<H3>error....</H3>");
                out.println("<HTML><HEAD><TITLE>Access Denied</TITLE></HEAD>");
        out.println("<BODY>Your login and password are invalid.<BR>");
        out.println("You may want to <A HREF=\"/jsp/testing/login.html\">try
again</A>");
        out.println("</BODY></HTML>");

    }

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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

Reply via email to