Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp and jstl

 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is difference betweeen
Q1)<%@include %> and <jsp:inlcude>
Q2)<jsp aram> vs <c aram>?
Q3)Please explain in detail <c:set target>,<c:url>? why they are more used?
 
Rancy Chadha
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amol,
Here are the answers to your questions:
Q1)What is the difference between <%@include %> and <jsp:include>
Ans: Both are used to include contents from specified resource in the called page.But the basic difference is <%@ include> directive does the inclusion of resources at the translation time and <jsp:include> standard action does it at the request time.

Q2)<jsp: param> vs <c: param>?
Ans: You cannot compare the two because <jsp: param> standard action is used for defining key/value pair for standard actions like <jsp: include>, <jsp: forward> and <c: param> JSTL action is used for adding request parameters to a URL and it is only used with JSTL actions like <c: import>, <c: url>, <c: redirect>

Q3)Please explain in detail <c:set target>,<c:url>? why they are more used?
Ans: <c: set target="bean object|Map"> is used for setting value of a property of a specified bean or if used with Map object it is used to set value of a Map key. Most of the times we are using beans to perform certain operations so <c:set target> is mostly used because <c:set var> version of this action is used to set simple variables only.
<c:url> without body is used to perform URL Rewriting and this is performed to ensure session is maintained even if client browser has cookie disabled. The second version of this action is the one with body and the body of <c:set> can take only <c aram> in it. This version is used to perform URL Encoding. What it actually does is, it replaces certain reserved/unsafe characters with different characters does performing encoding.

I hope this helps you. In case anything is incorrect please let me know.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer to your first question is also in the FAQ :
http://faq.javaranch.com/view?IncludesActionDirective
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic