?
Solved

Regarding tags.

Posted on 2005-04-29
5
Medium Priority
?
245 Views
Last Modified: 2013-11-24
I am not understanding what does a tag basically do? what are the advantages of using a tag? Is there any tutorial which provides good explanation on these stuff?

kindly guide me.

Thanks
0
Comment
Question by:icbwubr
  • 2
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
bloodredsun earned 2000 total points
ID: 13900129
To flesh out what objects links say:

>> I am not understanding what does a tag basically do
Tags, meaning custom tags, allow you to remove your java code from being inside scriplets in your jsps to their own file. Instead you use a <tag> almost as a placeholder that tells the server to execute the java stored in the tag class file. So where a file would (without tags, have this)

no_tags.jsp
--------------
<%
try{
      Class.forName( driver ) ;
      conn = DriverManager.getConnection(dbURL, login, password);
      stmt = conn.createStatement() ;
      stmt.executeQuery( " select * from blog group by created desc limit 50") ;

    }catch (Exception e){
      System.out.print("Whoops, buggered") ;
    }
%>

tags.jsp
---------------
<sql:query var="queryResultsSet" dataSource="${dataSrc}">
 select * from blog group by created desc limit 50
</sql:query>

>>what are the advantages of using a tag?
Code re-use, increased productivity, easier manintainablitly, allows people familiar with HTML to edit JSPs as they can recognise tags easily and not touch them where they would have difficulty editing a JSP with scriplets.

>>Is there any tutorial which provides good explanation on these stuff?
Objects has given you some excellent resources in the post above.

to see some very useful tags go here: http://jakarta.apache.org/taglibs/index.html and especially have a close look at JSTL which are the Java Standard Tag Libraries.
0
 
LVL 2

Expert Comment

by:patbin
ID: 13900894
tegs are basically used to distinguish between html and jsp
if u are using jsp files then u can embed java logic within jsp pages
eg
<input type="text" value='<% out.println("xyz"); %>' >
it will givu text box with value xyz

what are the advantages of using a tag?
java logic and html can be embedded in same page

Is there any tutorial which provides good explanation on these stuff?
http://jakarta.apache.org/taglibs/index.html
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13901157
Sorry patbin but I believe that you have misunderstood the question.

What you are talking about and the example you gave is not the use of java tags but java scriptlets. The java tags page on the sun website specifically says "Tag libraries reduce the necessity to embed large amounts of Java code in JSP pages by moving the functionality of the tags into tag implementation classes." which show you that tags are not just java code in the HTML but are something different.

Tags allow you to remove code from the page not embed it.
0
 
LVL 2

Expert Comment

by:patbin
ID: 13904185
ok bloodredsun i am sorry for my answer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question