You may have some other fields with the name "Name" in your html page.
So first I would make sure I don't have any duplicate field names in my
html page.

--Pradeeep


Pradeep Paudyal
Software Engineer,
Bricsnet US
Ph: 603 559 2505



On Tue, 21 Nov 2000, Theodor Goulas wrote:

> Hello everyone,
>
> I wrote a simple servlet application which take the user input from a
> web page and return it to a html page.
> The problem is by testing if the value is null or not.
> It suppose to return some massage if the value is null, let's say "No
> value" and the value, if it's not null.
> Here is some source code :
>
> import java.io.*;
> import java.lang.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class EinfachesServlet extends HttpServlet{
>
>   public void doPost (HttpServletRequest request,
>    HttpServletResponse response)
>    throws ServletException, IOException {
>
>      response.setContentType("text/html");
>
>   PrintWriter out = response.getWriter();
>
>   out.println("<HTML><HEAD><title>Example</title></HEAD>" + "<body
> bgcolor=FFFFFF>");
>
>     out.println("<table >");
>     out.println("<tr>");
>     out.println("<th></th>");
>     //out.println("<th></th>");
>     out.println("</tr> ");
>     out.println("<tr> ");
>
>     String NAME   = request.getParameter("Name" );
>      String Result = "No value";
>
>        if (NAME==null){
>          out.println("<td>"+ Result.toString() + "</td> ");
>       } else {
>             out.println("<td>Name entered:"+NAME.toString()+ "</td>");
>         }
>
>          out.println("</tr>");
>        out.println("<tr>");
>
>     String DATE = request.getParameter("Datum");
>
>       if (DATE !=null){
>        out.println("<td>Date entered:"+ DATE + "</td>");
>      } else {
>           out.println("<td>No value</td>");
>         }
>      out.println("</tr>");
>       out.println("</table> ");
>
>
>   out.println("Return to: <A HREF=../Projekt.html>Projekt </A>");
>
>    out.println("</body></HTML>");
>    out.close();
>   }
> }
>
> If there is not input I get the message "Name entered: " instead of  "No
> value".
> What should I change ? The first time I used ...if (Name != null) {...do
> something} just  like the second part with the date.
> The second time I tried to make an Object using the new(String Name =
> new String(request.getParameter("Name") )
> but it steel didn't work fine.
> Please send me some solutions.
> Thank you very much.
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to