Sufi,
Your if statement should not be comparing the string values with
null.  Instead it should use the equals() method with an empty string as a
parameter.  Html TEXT input tags will send an empty string as a parameter
for entries where nothing is entered.

try this:

<% if ( "".equals(ipaddress)&& "".equals(user))&& "".equals(newname)&&
"".equals(jack)&&
("".equals(os) && "".equals(pc) && "".equals.(processor) &&
"".equals(memory) && "".equals(domain)) {
         /* do something */
}
%>

Note: Using the .equals(varName) method on a quoted string is more
desirable than using varName.equals("...") because the the former style
will never cause a null pointer exception if varName == null.  This could
happen in this example if the JSP was modified so that one of the INPUT
tags was removed from the form.

-Richard

At 06:45 PM 9/6/01 +0000, you wrote:
>I have a file called add.jsp, the form that has the input fields and the
>action processing are all in this file, what I want is :
>when this file is for the first time displayed it will not be processed but
>only show the form, The problem is when I filled up all the fields and I
>submit the if statment never executed.
>
>Thanks
>
><%
>String ipaddress = request.getParameter("ipaddress");
>System.out.println("ipaddress ================" + ipaddress);
>String user      = request.getParameter("user");
>String newname   = request.getParameter("newname");
>String jack   = request.getParameter("jack");
>String os        = request.getParameter("os");
>String pc        = request.getParameter("pc");
>String processor = request.getParameter("processor");
>String memory    = request.getParameter("memory");
>String domain    = request.getParameter("domain");
>%>
><% if ( (ipaddress!=null)&& (user!=null)&& (newname!=null)&& (jack !=null)&&
>(os !=null)&&
>        (pc !=null)&& (processor!=null)&& (memory !=null)&& (domain !=null))
>                { %>
>
>DTABASE OPERATION
><% } %>
>
><form method="POST" action="add.jsp">
>input fields here
><form>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>===========================================================================
>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://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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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