DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006

    when null!=null (jsp)

    hello all,

    having a little trouble today... i can't test for null correctly. some code:

    String thisString = null;
    String thisString_sent = request.getParameter("thisString");

    if (thisString_sent!=null)


    <form method="post" action="#">
    <input type="button" onclick="form.submit();" value="<%=thisString_sent%>">
    <input type="hidden" name="thisString" id="thisString" value="<%=thisString_sent%>">

    so... request.getParameter("thisString") should receive null from post data and it does as you can see by the button value. so, why does it even enter the if statement? any ideas?


  2. #2
    Join Date
    Feb 2006
    Cologne - Germany
    <input type="hidden" name="thisString" id="thisString" value="<%=thisString_sent%>">
    if thisString_sent is null, this will place the string "null" at this place.
    why don't you just let the jsp print out the value of thisString_sent to debug?

  3. #3
    Join Date
    May 2006
    I have run into that same problem you are having using the Tomcat ServletEngine (3 or 4 times this week infact). I don't know if this is a bug in tomcat's newest release or what. The problem as I have experienced it is that for some reason, using the != null operand in a jsp tag does not work the way it should. My work around was to use if == null { do nothing... } else { do what I need to do. That seems to work just fine.
    Last edited by smcneill; 05-03-2006 at 09:29 AM.

Similar Threads

  1. Servlets and JSP
    By Purnima in forum Java
    Replies: 1
    Last Post: 12-29-2005, 04:14 AM
  2. Handling XMLHttp request in JSP
    By jijesh in forum Java
    Replies: 0
    Last Post: 07-19-2005, 08:55 AM
  3. How to invoke C DLLs from a JSP
    By Mohan in forum Java
    Replies: 6
    Last Post: 03-02-2001, 02:42 PM
  4. Must I compile a bean for a JSP page?
    By Alison in forum Java
    Replies: 1
    Last Post: 07-26-2000, 02:16 PM
  5. JSP and the <SERVLET> tag
    By Dusty in forum Java
    Replies: 2
    Last Post: 04-07-2000, 01:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.