Hi...

Have been trying to get my JSP to read info from my bean instance....but
can't seem to do so.  Need some advice.
Below are my rough codes.

I have a form(Parameters are: userId and passwd) that submits to my
LoginServlet.


import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import ccenquiry.LoginBean;

public class LoginServlet extends HttpServlet {
        public void init(ServletConfig conf) throws ServletException {
                super.init(conf);
        }

        public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException {

                HttpSession session = req.getSession(false);
                if (session == null) {
                        res.sendRedirect("http://localhost:8080/ccEnqError.htm");
                }

                if ((req.getParameter("userId") != null) && 
(req.getParameter("passwd") !=
null)) {
                        // instantiates the LoginBean.
                        LoginBean loginUser = new LoginBean();
                        loginUser.setUserId(req.getParameter("userId"));
                        loginUser.setPasswd(req.getParameter("passwd"));

                        if (true) {
                                session.putValue("ccenquiry.loginuser", loginUser);
                                String address = "/jsp/ccenquiry/banner.jsp";
                                ServletContext sc = getServletContext();
                                RequestDispatcher rd = 
sc.getRequestDispatcher(address);
                                rd.forward(req, res);
                        }
                }
        }
}



Below is my banner.jsp




<%@ page import="ccenquiry.LoginBean" session="true" info="banner" %>

<jsp:useBean id="loginUser" scope="session" class="ccenquiry.LoginBean" />

<html>
<body>

<!-- start banner table -->
<table width=600 align=center>
<tr>
        <td align=center><font size=2 face="Lucida Sans Unicode">User Id is:
<jsp:getProperty name="loginUser" property="userId" /></font></td>
</tr>
</table>
<!-- end banner table -->

</body>
</html>



Thanks in advance.

.js


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to