Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TLD doubt

 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • 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. <<INSERT CODE HERE >>
7. <mytags:tag1 />

tld1.tld:



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

1. <% taglib prefix="mytags" uri="/WEB-INF/mytlds/tld1.tld" %>
2. <% taglib prefix="mytags" uri="http://abt.com/tld/mytaglib" %>

correct answer option 1. why option 2 is wrong?

Srividhya
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both of those are incorrect as they should start with <%@ as in:Also you write "abc.com" in the TLD and "abt.com" in your answers - was this deliberate? Aside from that, I notice nothing immediately wrong with either possibly answer, though the full TLD hasn't been given so some assumptions need to be made. Traditionally (i.e. pre J2EE 1.4) only method 2 worked; the first approach was added as an extra in J2EE 1.4. You might also find this useful from the IBM Rational site.
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charles

Sorry for those mistakes. Please find the correct code below

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. <<INSERT CODE HERE >>
7. <mytags:tag1 />

tld1.tld:

code:

<uri>http://abc.com/tld/mytaglib</uri>
<tag>
<name>tag1</name>
<tag-class>com.abc.Tag1</tag-class>
<body-content>scriptless</bodycontent>
</tag>



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

1. <%@ taglib prefix="mytags" uri="/WEB-INF/mytlds/tld1.tld" %>
2. <%@ taglib prefix="mytags" uri="http://abc.com/tld/mytaglib" %>

If we were asked to select either of these options which one should we select?

Thanks
Srividhya
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They both look correct to me... so you wouldn't get a real SCWCD exam question asking you to choose between them. Sometimes mocks can be a bit peculiar - what is the source of your question?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic