• Post Reply Bookmark Topic Watch Topic
  • New Topic

Check if a value is of type Long in JSTL  RSS feed

 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I need to check in a JSP page that uses JSTL, to check if a value is of type Long. Is it possible to check using JSTL if a value is of some type ? How ?

TIA,
Ankit Chandrawat
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need to know this? It's a very odd question.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use some thing like <c:if test="${item.class.name == 'Long')}">
What are you trying to achieve by checking the type of an object ?
 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I need to execute a <c:forEach> only when then a particular id is of type Long (or you can say a numeric value).
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like something that should be abstracted in the controller to me.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Chandrawat wrote:Actually I need to execute a <c:forEach> only when then a particular id is of type Long (or you can say a numeric value).

You can have your controller make sure that the value is of numeric type. Then in your view just check if the attribute exists, and if it exists, you can iterate over it as you know it would be numeric.
 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok..let me try, I am hopeful of getting some positive out of it. Thanks a lot for prompt response and other ideas.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!