Actually, as far as I know, if you submit the form, the username textfield is not null, but an empty string. You should test for null and for an empty string. -----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of liuhao Sent: Wednesday, April 12, 2000 11:37 PM To: [EMAIL PROTECTED] Subject: about scpritlet hi everyone: i find something wrong in my following files. i do not understant what is the effect of "<% if (request.getParameter("usename")!=null) { %>" in the myjsp.jsp. if i input nothing in the text form on the browser, server will response"Hello !"to me. it is "null" for the variable of "usename"!? if this srciptlet is no effect on my program, why is not there display of "Hello !" before i click the "Submit" button. please help! thank you. javabean file: public class HiBean { private String usename; public HiBean() { usename=null; } public void setusename(String name){ this.usename=name; } public String getusename(){ return usename; } } myjsp.jsp: <html> <body> <form method="get"> <input type="text" name="usename"> <br> <input type="submit" value="Submit"> </form> <% if (request.getParameter("usename")!=null) { %> <%@ include file="response.jsp" %> <% } %> </body> </html> response.jsp file: Hello <jsp:getProperty name="hello" property="usename" />! =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". 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 =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". 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