RSS

Tip of the day

28 Mar

Hi folks,

There are many ways to handle the empty string check in the JSP page.

Below are the some of the ways we can handle. Here is the sample code.

JSTL code

<c:choose>
<c:when test=”${not empty formbean.name}”>
<name>${formbean.name}</name>
</c:when>
<c:when test=”${empty formbean.name}”>
<name>${formbean.sname}</name>
</c:when>
<c:otherwise />
</c:choose>

Scriplets code

<%
if(formbean.name !=null && formbean.name != “”){
System.out.println(“Name is >> “+name);
}else{
do something else
}
%>

Happy Coding!!.

Stay tuned to know more updates.

Have a nice day 🙂

Advertisements
 
Leave a comment

Posted by on March 28, 2013 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: