• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

the value of <%@taglib uri="" %>?

 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The tag library descriptor shown in the exhibit has been kept in /WEB-INF/mytlds/tld1.tld folder of the webapplication. What should be inserted at line 6 so that line 7 will work as expected?

5. ...
6. &lt;&lt;INSERT CODE HERE &gt;&gt;
7. &lt;mytags:tag1 /&gt;


Assume that the application can be accessed through http://localhost/myapp



1. &lt;% taglib uri="/WEB-INF/mytlds/tld1.tld" %&gt;
2. &lt;% taglib prefix="mytags" uri="/WEB-INF/mytlds/tld1.tld" %&gt;
3. &lt;% taglib prefix="mytags" uri="http://abt.com/tld/mytaglib"; %&gt;
4. &lt;% taglib prefix="mytags" uri="http://localhost/myapp/WEB-INF/mytlds/tld1.tld"; %&gt;

the 2nd option is true. Why?? I thought the value of &lt;uri&gt;&lt;/uri&gt; tag in the TLD is specified in the &lt;%@taglib uri=""%&gt; directive. I know that we can specify the direct path to the TLD file as a value of uri attribute. I got confused. Please help

Please correct me if I am wrong.
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all Poonam can you please QuoteYourSources.

I couldn't understand which option is given as true- 2 or 3 or both. I think all the options are wrong. None of them is a taglib directive. And just take a look into this page to be more clear about the use.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to Enthuware option 2 is correct. I don't know why?
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
according to me option 3 should be correct because
<uri> tag value should be match with the <%@ taglib uri="" >
please correct me if I m wrong .
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I did some research and this tutorial helped me a lot. Option 3 is not correct. There are two ways you can use the uri attribute of the taglib directive.

1. You define a .tld file and then include its reference in the web.xml file. In that case you can use the uri which is given in the .tld file in the taglib directive.

2. You define a .tld file and then use the path to the .tld file in the uri attribute of the taglib directive.

So option 2 is logically correct but as I said earlier too, none of them is a taglib directive so all are wrong
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
still not cleared
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Poonam Agarwal wrote:still not cleared



You are now SCWCD cleared then what to worry . Anyways it is good to have the enthusiasm to learn. There are two ways of using the uri attribute of the taglib directive.

1. I declare the tld1.tld file in the /WEB-INF/mytlds/tld1.tld folder and then put this code in my web.xml




Then in my JSP page I need to write this



2. The other way is that I add the tld1.tld file in the /WEB-INF/mytlds/tld1.tld folder and use this in my JSP page

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ankit, to make it clear.

If you read the post carefully I have also insist on the same point, might not good with words while posting.
anyways to confirm it once again for me.

Thanks again
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys i am trying to be a scwcd. i have a question
in the next code which tags are mandatory??

if uri tag is not mandatory. what i would put in the jsp..
<@ tagliburi ='myuri' prefix = 'myprefix'%>
sorry by my poor english thanks a lot
 
Creator of Enthuware JWS+ V6
Posts: 3412
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

in the next code which tags are mandatory??


Have a look here: dtd

if uri tag is not mandatory. what i would put in the jsp


Just look back in this thread and you will see that you can use a direct reference to the tld file:

Regards,
Frits
 
Cristian Daniel Ortiz Cuellar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frits Walraven wrote:

in the next code which tags are mandatory??


Have a look here: dtd

if uri tag is not mandatory. what i would put in the jsp


Just look back in this thread and you will see that you can use a direct reference to the tld file:

Regards,
Frits


thanks fritz. is clear now.
god bless you
 
Arthur, where are your pants? Check under this tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic