Meaningless Drivel is fun!*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes the value of <%@taglib uri=?" title="" /> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "the value of <%@taglib uri="" %>?" Watch "the value of <%@taglib uri="" %>?" New topic
Author

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

Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
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.

Thanks <br />Poonam Agarwal SCWCD 86%
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
According to Enthuware option 2 is correct. I don't know why?
ankit kumar
Ranch Hand

Joined: Apr 28, 2008
Posts: 108
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 .


Cleared SCJP 1.5 | Cleared SCWCD 5.0
SCDJWS 6 in progress.....
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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

Joined: May 12, 2008
Posts: 323
still not cleared
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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

Joined: May 12, 2008
Posts: 323
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
Cristian Daniel Ortiz Cuellar
Ranch Hand

Joined: Feb 02, 2011
Posts: 81
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
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1665
    
  25

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

Joined: Feb 02, 2011
Posts: 81
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: the value of <%@taglib uri="" %>?