• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

q on JSTL

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
wht is wrong with the following JSP:
<%@taglib uri="http://java.sun.com/jsp/jstl/core prefix="c">
<% Double result = new Double(5);
pageContext.setAttribute("result",result);
%>
<c:if test="${result==5}" var="result" scope="page"> The result is ${result}
</c:if>

1) A classCastException is thrown.
2) A compilation error.
3) result is true.
4) result is 5.

i feel is is 3, but i have a doubt regarding 1. Plz help.
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it is option 2.

Regards,
Priya.
 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi priya,

Y do u feel, it is 2. plz explain.
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The compilation error is because of

<%@taglib uri="http://java.sun.com/jsp/jstl/core prefix="c">

This should be

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

Otherwise it will return true.

thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic