Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

c:set in jstl

 
sangeeta kapoor
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In <c:set var=... /> version if value is null the attribute is removed.
But what happens if the value is null in target version.
 
Colin Fletcher
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the spec say about c:set ?
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unlike var attribute the target attribute is used to set the values for existing java bean or a map. The target attribute in <c:set> tag should always evaluate to the real object. In case the target object is null, it will throw the exception on the Page. Please look at the following example:

JSP Page:


Exception thrown:



Thanks,

Durga
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!