tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33370] New: - On Tomcat 4.1.24, this works fine but with Tomcat 5, I experience the following
Date Wed, 02 Feb 2005 20:17:11 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33370>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33370

           Summary: On Tomcat 4.1.24, this works fine but with Tomcat 5, I
                    experience the following
           Product: Tomcat 5
           Version: Unknown
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: joel.shaw@tellabs.com


On Tomcat 4.1.24, this works fine but with Tomcat 5, I experience the following 
problem.
In the code below my app knows uid until it reaches the navigation servlet.
In summary:
index.html: uid requested on this page
authenticateUser.java: uid = The provided uid.
frame.java: uid = The provided uid.
navigation.java: uid = null

Code:

Index.HTML:
<HTML>
    <HEAD><TITLE>DaTitle</TITLE></HEAD>
    <BODY>
        <CENTER>
	        <H1>User Login Page</H1>
            <BR>Please provide your user credentials.
            <BR>
            <FORM ACTION="servlet/authenticateUser" METHOD="POST">
                <TABLE ALIGN="center" WIDTH="100%" CELLSPACING="2" 
CELLPADDING="2">
                    <TR>
                        <TD ALIGN="right" WIDTH="45%">User Name:</TD>
                        <TD ALIGN="left"><INPUT TYPE="TEXT" NAME="uid" 
ALIGN="left" SIZE="20"></TD>
                    </TR>
                    <TR>
                        <TD ALIGN="right" WIDTH="45%">Password:</TD>
                        <TD ALIGN="left"><INPUT TYPE="PASSWORD" NAME="pwd" 
ALIGN="left" SIZE="20"></TD>
                    </TR>
                </TABLE>
                <HR><BR>
                <INPUT TYPE="Submit" NAME="login" VALUE="Login">
            </FORM>
        </CENTER>
    </BODY>
</HTML>

authenticateUser.java:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class authenticateUser extends HttpServlet {
	public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String userName = request.getParameter("uid");
		String password = request.getParameter("pwd");
		session.setAttribute("uid", userName);
		try {
			ResourceBundle resourceBundle = ResourceBundle.getBundle
("LocalString", request.getLocal());
			String storedPassword = resourceBundle.getString("UID." 
+ userName + ".Password");
			if (password.equals(storedPassword)) {
				RequestDispatcher rd = getServletContext
().getNamedDispatcher("frame");
				rd.forward(request, response);
			} else {
				RequestDispatcher rd = 
request.getRequestDispatcher("/Invalidlogin.html");
				rd.forward(request, response);
			}
		} catch (MissingResourceException ne) {
		}
	}
}

frame.java:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class frame extends HttpServlet {
	public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		StringBuffer frame = new StringBuffer("");
		String space = "&nbsp;";
		String CRLF = "\r\n";
		String tab = "\t";
		ResourceBundle rb = ResourceBundle.getBundle("LocalStrings", 
request.getLocale());
		PrintWriter out = response.getWriter();
		frame.append("<HTML>" + CRLF
				+ tab + "<HEAD>" + CRLF
				+ tab + tab + "<TITLE>" + rb.getString
("FrameServlet.title") + "</TITLE>" + CRLF
				+ tab + "</HEAD>" + CRLF
				+ tab + "<FRAMESET COLS='250,*' BORDER='0'>" + 
CRLF
				+ tab + tab + "<FRAME NAME='left' 
SRC='navigation' SCROLLING='auto'>" + CRLF
				+ tab + tab + "<FRAME NAME='right' 
SRC='todoList'>" + CRLF
				+ tab + tab + "<NOFRAMES>" + CRLF
				+ tab + tab + tab + "<BODY>" + CRLF
				+ tab + tab + tab + tab + "</P>Please use a 
browser that supports frames" + CRLF
				+ tab + tab + tab + "</BODY>" + CRLF
				+ tab + tab + "</NOFRAMES>" + CRLF
				+ tab + "</FRAMESET>" + CRLF
				+ "</HTML>");
		response.setContentType("text/html");
		out.println(frame);
	}
}

navigation.java:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class navigation extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse 
response)throws ServletException, IOException {
		doPost(request, response);
	}
	public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String userName = (String)session.getAttribute("uid");

		ResourceBundle resourceBundle = ResourceBundle.getBundle
("LocalStrings", request.getLocale());
		String firstName = resourceBundle.getString("UID." + userName 
+ ".firstName");
		String lastName = resourceBundle.getString("UID." + userName 
+ ".lastName");

		StringBuffer nav = new StringBuffer("");
		String space = "&nbsp;";
		String CRLF = "\r\n";
		String tab = "\t";
		nav.append("<HTML>" + CRLF
				+ tab + "<HEAD>" + CRLF
				+ tab + tab + "<TITLE>DaTitle</TITLE>" + CRLF
				+ tab + "</HEAD>" + CRLF
				+ tab + "<BODY BGCOLOR=\"WHITE\">" + CRLF
				+ tab + tab + "</P>" + firstName + CRLF
				+ tab + tab + "</P>" + lastName + CRLF);
				+ tab + "</BODY>" + CRLF
				+ "</HTML>");
		PrintWriter out = response.getWriter();
		response.setContentType("text/html");
		out.println(nav);
	}
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message