Hi malak,
Try this code :
<% String ipaddress = request.getParameter("ipaddress"); %>
<form method="POST" action="add.jsp">
<table border="0" cellpadding="4" width="90%">
<tr>
<td valign="top" bgcolor="#AFD0D1" color="red">
<font size="1" face="arial,helvetica"><b>Please add a new
entry, don't leave any field empty</b></font>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFCC66"><font size="2"
face="Verdana"><b></b></font></td>
</tr>
<tr>
<%=ipaddress%>
<td valign="top" bgcolor="#CCCCCC">
<font size="2" face="arial,helvetica">
<% if (ipaddress.length() == 0) { %>
<input type="text" size="45" name="ipaddress">IP Address<br>
<% } else { %>
<input type="text" style="background-color: #ffcccc"
size="45" name="ipaddress" value=<%=ipaddress%>>Reenter IP Address<br>
<% } %>
</tr>
</table>
</form>
I hope this is what you want.
hassan afif
-----Message d'origine-----
De : A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]] De la part de sufi malak
Envoy� : lundi 4 f�vrier 2002 16:24
� : [EMAIL PROTECTED]
Objet : simple question please
HI, I have a form, I want if this form is not processed, the fields
missing change the color ( this is done using style html), but I don't
know why the other fields entered have gone, here is the form :
<form method="POST" action="add.jsp">
<table border="0" cellpadding="4" width="90%">
<tr>
<td valign="top" bgcolor="#AFD0D1" color="red"><font size="1"
face="arial,helvetica"><b>Please add a new entry, don't leave any field
empty</b></font></td>
</tr>
<tr>
<td valign="top" bgcolor="#FFCC66"><font size="2"
face="Verdana"><b></b></font></td>
</tr>
<tr>
<%=request.getParameter("ipaddress")%>
<td valign="top" bgcolor="#CCCCCC">
<font size="2" face="arial,helvetica">
<% if (!("".equals(ipaddress))) { %>
<input type="text" size="45" name="ipaddress">IP Address<br>
<% } else { %>
<input type="text" style="background-color: #ffcccc" size="45"
name="ipaddress" value=<%=request.getParameter("ipaddress")%>>Reenter IP
Address<br> <% } %> .... </form>
My question why this line <%=request.getParameter("ipaddress")%>
works, and this :
<input type="text" style="background-color: #ffcccc" size="45"
name="ipaddress" value=<%=request.getParameter("ipaddress")%>>Reenter IP
Address<br> does not
Thanks
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
========================================================================
===
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://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
==========================================================================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://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com