• 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

c:url

 
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to me the correct answer should also ne a. But that is wrong.
Please advise,
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys i got it.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic