You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Taylor <ro...@yahoo.com> on 2002/02/14 21:43:14 UTC

Re:Nescape6.1 not rendering text fields: SOLVED

Just so someone else doesn't go through the same pain
as myself. Below is a synopsis of the problem and a
solution.

Problem:
I have a page with two forms (loginForm and
accountForm) on it. One form contains fields to log in
a user, the other contains fields to display the user
account information for them to edit. The normal
process is the user enters data in the login form and
submits (via a POST) the request to the LoginAction
class which processes the request, puts account
details in the session and redirects (not forwards)
back to the page. The accountForm "looks" in the
session and pulls the account details out into the
appropriate form input fields. Then, if the user
wishes, they can edit their account details and submit
the changes.

This process works flawlessly in IE.

In Netscape6.1 none of the text fields render the data
that is contained in their value attribute's. That is,
an input element may look like this, <input
name="name1" type="text" value="robert" /> but nothing
is rendered by the browser. To complicate matters, in
Netscape4.7, I was getting a 302 status (file has been
temporarily moved). 

So I created the following JSP page to reproduces the
error and abstract away all of my other page stuff
(CSS, Javascript, etc...):

<%
	String submitted = request.getParameter("submitted");
	String user = request.getParameter("user") == null?
"":request.getParameter("user");
			
	if (submitted != null) {
		session.setAttribute("user", user);
		response. sendRedirect("/test.jsp");
		return;
	}
%>
<html>
<head>
	<title>Test Netscape</title>
</head>

<body>

<form name="form1" action="<%=request.getRequestURI()
%>" method="post">
	<input type="hidden" name="submitted" value="true" />
	<input type="text" name="user" value="<%=user%>"
/><br/>
	
	<input type="submit" value="Submit" />
</form>
<form>
<input type="text" name="user"
value="<%=(String)session.getAttribute("user")%>"
/><br/>
</form>
</body>
</html>

And still got the same behaviour. 


Solution:
Then completely on a guess I added an empty query
string to the redirect URL.

if (submitted != null) {
		session.setAttribute("user", user);
		response. sendRedirect("/test.jsp?"); <======= empty
query string
		return;
	}


And it worked on IE, Netscape6.1 and Netscape4.7! Go
figure. 


This took me 18 hours to figure out. Hopefully it will
save someone else some time. Or maybe I'm the only sap
who hasn't yet figured this one out.

Sorry about the formatting of the above code.

robert

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>