tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Wong <rw...@opsware.com>
Subject Re: Configuring Tomcat 5 to not display null value as word null
Date Sun, 22 Aug 2004 18:51:57 GMT
Thanks for the response.  Unfortunately, the objects are not necessarily 
obtained directly from the request parameter.  Sometimes data is 
massaged or obtained from other sources.  I was hoping that there is a 
generic way to override the behavior.  Since you mentioned about the 
used of filter, I actually do have a servlet filter and a servlet 
request wrapper for my application.  Maybe I would just override the 
getWriter method with a PrintWriter wrapper that outputs "" for null 
value?  Let me try to see what happens if I do that...


Thanks,
--
Rick


Justin Ruthenbeck wrote:

>
> There is no Tomcat magic configuration parameter to make this happen.  
> Instead, take a look at HttpServletRequestWrapper.  You can combine 
> that with a Filter to override the behavior of getParameter() for the 
> pages that need it such that it returns "" instead of "null" when no 
> such parameter value exists.
>
> If you're unfamiliar with the above concepts, check Google, so see:
> http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters-p4.html
>
> Good luck,
> justin
>
>
> At 04:54 PM 8/20/2004, you wrote:
>
>> Hi,
>>
>> I have the following JSP fragment:
>>
>> ....
>> case 1 = <%=request.getParameter("no_such_thing")%>
>> case 2 = ${requestScope["no_such_thing"]}
>> ....
>>
>> The output of the page is
>>
>> ...
>> case 1 = null
>> case 2 =
>> ...
>>
>> Is there any way that Tomcat can be configured to not display the 
>> word "null" if the value is null?  It is easy to replace the above 
>> example in case 1 by case 2, but in my case it is not easy to make 
>> such change to my existing code base (which I am migrating from 
>> another servlet engine that outputs null as "").  I have pages with 
>> the <input type=text> elements displaying the string "null" when 
>> there is no default value.
>>
>> Thanks,
>> -- 
>> Rick
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
> ______________________________________________
> Justin Ruthenbeck
> Lead Software Engineer, NextEngine Inc.
> justinr - AT - nextengine DOT com
> Confidential. See:
> http://www.nextengine.com/confidentiality.php
> ______________________________________________
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message