null to empty string

i was wondering if JSP has something like converting all null String into

an empty string to be display on the page input fields

currently, i have to do something like

public String emptyString(String s){

return (s ==null)?"": s;

}

i was hoping JSP have something that will do this automatically for you..

[527 byte] By [tnguyen1973a] at [2007-10-2 3:56:27]
# 1

Say for request.getParameter("userName")

<%= (request.getParameter("userName") == null)? "": request.getParameter("userName") %>

If you are using JSTL the c:out tag has a default value that you could set to a blank string.

Or you could create your own custom tag to do the same thing.

tolmanka at 2007-7-15 23:17:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
thanx. the taglib (JSLT) was what i was looking for..thought JSP has something similiar.
tnguyen1973a at 2007-7-15 23:17:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...