-
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)
out.print("::"+thisString_sent);
%>
<form method="post" action="#">
<input type="button" onclick="form.submit();" value="<%=thisString_sent%>">
<input type="hidden" name="thisString" id="thisString" value="<%=thisString_sent%>">
</form>
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?
thanks!
newb
-
<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?
-
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
-
Replies: 1
Last Post: 12-29-2005, 04:14 AM
-
Replies: 0
Last Post: 07-19-2005, 08:55 AM
-
Replies: 6
Last Post: 03-02-2001, 02:42 PM
-
Replies: 1
Last Post: 07-26-2000, 02:16 PM
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks