File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes problem with JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with JSTL" Watch "problem with JSTL" New topic
Author

problem with JSTL

sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
hi all,

i am running a query in jstl. in c:forEach i have something like this



now i want that if no record i featched then there should be a message like "No Data Found!!". for this i am using below code ----




but it's not working. can somebody please suggest me what will be the value of viewRowsad[0] in case no record is featch. please take note in my case i can't make additional query to first check that if there is data in the table for user. if want to make this in a single query.
Darren Edwards
Ranch Hand

Joined: Aug 17, 2005
Posts: 69

If you are checking for a null you should not be wrapping it in ' ' (that treats it as a String).

Am not 100% certain without testing myself, but I think you can also say
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1027
Actually if no rows are retrieved, then the rowCount of the query result will be 0.
You can test it like this:



If no rows are returned, the c:forEach won't even iterate once.
sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
thanks Stefan, your code workes for me.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with JSTL