Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

c:url

 
Amandeep Singh
Ranch Hand
Posts: 850
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question No: 6 (Question ID: 2404) Building JSP Pages Using Tag Libraries : Tough
Contributed By: Enthuware

Problem

Which of the following code correctly performs URL rewriting?


Options

Select 1 correct option.

1 <a href="<c:url url='/cart.jsp?userid='ramesh'/>">View Cart</a>

2 <a href="<c:url url='/cart.jsp' userid='ramesh'/>">View Cart</a>

3 <a href="<c:url url='/cart.jsp' attr='userid' value='ramesh'/>">View Cart</a>

4 <a href="<c:url url='/cart.jsp'>
<c aram name='userid' value='ramesh'/>
</c:url>">
View Cart</a>
 
Amandeep Singh
Ranch Hand
Posts: 850
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me the correct answer should also ne a. But that is wrong.
Please advise,
 
Atul Samnerkar
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 <a href="<c:url url='/cart.jsp?userid='ramesh'/>">View Cart</a>
>> in this case, the url attribute for c:url will be completed partailly coz of multiple usage of single quote. So Containter will treat the value of URL as url='/cart.jsp?userid='. Hence this is wrong.

I feel the correct answer should be 4. this way the parameter is passed using 'param'.


Thanks,
Atul Samnerkar
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amandeep Singh:

Which of the following code correctly performs URL rewriting?




<c:url value="" />

Hope This Helps
 
Amandeep Singh
Ranch Hand
Posts: 850
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys i got it.
 
Savyatha Reddy
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so the attribute for c:url tag should be "value" and it is not "url". then which among the 4 options would be correct as all the 4 are using url attribure
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic