aspose file tools*
The moose likes JSP and the fly likes To Hans: Classic Tag, Simple Tag and Tag files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "To Hans: Classic Tag, Simple Tag and Tag files" Watch "To Hans: Classic Tag, Simple Tag and Tag files" New topic
Author

To Hans: Classic Tag, Simple Tag and Tag files

Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Hi Hans,
I used your book as one of the references for preparing the SCWCD beta exam.
Although I have studied it, there are still some confusions about the tags.
I wonder why we have so many types of tags, in fact, they looks similar (Classic Tag and Simple Tag). Does the tag file a version for easy tag implementations? (like the relationship of JSP and Servlets)
Nick.


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Nicholas Cheung:

I wonder why we have so many types of tags, in fact, they looks similar (Classic Tag and Simple Tag). Does the tag file a version for easy tag implementations? (like the relationship of JSP and Servlets)

Yes, Nick, I believe that Classic Tag might be a bit difficult for Non-JSP programmers or even for some JSP programmers... That's why Tag File implementation is created for builing a bridge for a gap between Non-JSP programmers and experienced JSP programmers...
It is similar to the comparison of PHP and JSP... I do believe that coding in PHP is extremely easy and a lot easier than dealing with JSPs and servlets in J2EE... Even non-progrommers can fetch up the idea of PHP and can code within a small period of learning time.... But there are a lot of weakness in PHP... Since I am now working on a freelance project using PHP, I found it very easy to follow up the concepts in PHP.... I learnt a lot faster than when I learnt JSPs...
Just my opinion, Nick... I hope that the author can explain it far more better than me for sure.... Let's wait for Mr.Bergsten to reply to this thread...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Hans Bergsten
Author
Ranch Hand

Joined: Dec 01, 2003
Posts: 106
Originally posted by Nicholas Cheung:
Hi Hans,
I used your book as one of the references for preparing the SCWCD beta exam.
Although I have studied it, there are still some confusions about the tags.
I wonder why we have so many types of tags, in fact, they looks similar (Classic Tag and Simple Tag). Does the tag file a version for easy tag implementations? (like the relationship of JSP and Servlets)
Nick.

Nick, this is a sign of how the JSP specification evolves over time. The classic tag handler (a Java API) was introduced in JSP 1.1, but many programmers had a hard time to grasp the complex lifecycle used for this type of tag handler. This is evident from all bugs discovered when JSP containers started to support "tag handler pooling", and all the questions about when the release() method is supposed to be called in all JSP forums.
Another problem with classic tag handler was that you had to be a Java programmer to develop them, and that some of them ended up with tons of println() calls outputting HTML elements.
For JSP 2.0, we did two things: we introduced a new Java API (dubbed the Simple Tag Handler API) and added the "tag file" concept. The Simple Tag Handler API supports a much simpler development model, removing all the complex lifecycle issues. However, custom tags implemented with this API can't have bodies containing "scriptlets" (Java code), so the old classic API is still supported. In practical terms, though, there's really no reason to use scriptlets anymore (the EL is so much easier to use), so I recommend that you use the Simple Tag Handler API for all new custom tag libraries.
Tag files, finally, allows you to combine a bit of HTML an a few JSP tags to create simple, reusable custom tags. Because they don't contain any Java code, they can be developed by non-programmers. At the same time, they avoid the hords of println() statements needed to generate things like HTML tables in a Java tag handler, so they are ideal for any tag that generates lots of HTML. Another benefit is that you can just edit the tag file and test it immediately, without having to compile a Java file, install it and (in some containers) restart the application to pick up the new class file. I often develop custom tags as tag files first, and convert them to the Java API only if I need to squeeze out every ounce of performance.


Hans Bergsten, hans@gefionsoftware.com<br />Author of O'Reilly's<br />- JavaServer Pages,<br />- JavaServer Faces<br /><a href="http://www.hansbergsten.com/" target="_blank" rel="nofollow">http://www.hansbergsten.com/</a>
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Hi Hans,
Thanks for the detail explanation.
I also feel that Tag file is a bit more easy to understand, just similar to the concept of writing JSP instead of Servlet.
However, I also found difficulty in EL. EL maybe a bit easier to write and has a clear coding in the page, when compared to scriptlet. But, especailly when I come across the SCWCD beta exam, for the same output, there can be many many styles of EL. The specification in the JSP 2.0 does not mention much about EL. It mentions only the basic stuffs. It turns out to me that is, the specification seems does not cover the whole picture.
Thus, how detail does the book discussing EL? I am trying to use EL together with JSTL and Struts for my new project, but I still need to learn more from this aspect.
Nick.
Hans Bergsten
Author
Ranch Hand

Joined: Dec 01, 2003
Posts: 106
Originally posted by Nicholas Cheung:
Hi Hans,
Thanks for the detail explanation.
I also feel that Tag file is a bit more easy to understand, just similar to the concept of writing JSP instead of Servlet.
However, I also found difficulty in EL. EL maybe a bit easier to write and has a clear coding in the page, when compared to scriptlet. But, especailly when I come across the SCWCD beta exam, for the same output, there can be many many styles of EL. The specification in the JSP 2.0 does not mention much about EL. It mentions only the basic stuffs. It turns out to me that is, the specification seems does not cover the whole picture.
Thus, how detail does the book discussing EL? I am trying to use EL together with JSTL and Struts for my new project, but I still need to learn more from this aspect.
Nick.

The JSP specificaton describes the EL in formal terms, but doesn't include examples of how to use it; it is a specificaton after all, targetted primarily to people who implement JSP containers rather than to people using JSP to develop applications.
My book covers the EL in detail with many examples.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
So, Mr.Bergsten, do u think that evolution of EL and various implementation of Custom Tags will make other non-J2EE(PHP,ASP) developers interested in JSP 2.0 techonology?
I'm not sure about in U.S.? but here in Thailand, the world of small- and medium-sized web app is dominated by PHP and ASP(not .Net)... But in Enterprise application, they do prefer J2EE or .Net... It seems that there are a lot of freelance works on such small- and medium-sized application and it seems like they are able to beat J2EE in those areas...
But now JSP 2.0 is out and EL is evolved... I think this will surely impact the current market share of J2EE in Thailand...
Mr.Bergsten, what is your opinion about the JSP 2.0 and small/medium-sized web app?
Thanks for being here...
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Technologies change ususally depends on the Managemenet and cost, I feel.
If your company has already sticked with MS, it is difficult to change to J2EE platform unless there is a really cool reason. Because when the platform changes, all systems previously developed will no longer useful, unless it keeps 2 versions, or it never replaces the old one.
Honestly, JSP 2.0 does provide many new functions and make coding become easier, especially the EL and Tag file, while compare to the old style scriptlets, and Classic tags.
Nick.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Ko Ko, I've worked on several applications using J2EE both small and large over the years.
There is indeed a misconception in many companies (not the least inside IT shops, even J2EE shops) that J2EE == EJB and that therefore J2EE is a bloated monster that's only good for huge applications that access massive datastores on large databases or mainframes.
Of course nothing could be further from the truth. Servlets and JSPs alone are quite powerful, especially when combined with databases through DAO frameworks or some other data abstraction layer.
In fact, in 5 years working with J2EE I've encountered more and more hostility towards EJB, and never needed to use it.
The main thing needed to get more adoption of J2EE in smaller applications (or in smaller companies, I've done small applications for huge multinationals in Servlet/JSP) is to get people to understand that EJB is not needed or even desirable in most cases.
In fact, one of my first brushes with JSP was a request from a multinational financial institution to translate an ASP application running on an Access database to JSP connecting to Oracle.
Many potential customers still think a J2EE solution is expensive because of that EJB misconception.
They already have IIS (after all, it comes with their Windows server...) and see the prices demanded by Bea, Netscape, IBM and Sun for their appservers. They don't see the less expensive (but quite as capable) Tomcat and Orion servers.
They also see the easy integration of their MS SQL server with ASP, but don't know about available JDBC drivers as they're not advertised in MSDN journal.


42
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

One of advantages of MS technologies is user friendliness. They are easier to develop than J2EE. ASP .NET scores over JSP.


Groovy
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Jeroen Wenting:
Ko Ko, I've worked on several applications using J2EE both small and large over the years.
There is indeed a misconception in many companies (not the least inside IT shops, even J2EE shops) that J2EE == EJB and that therefore J2EE is a bloated monster that's only good for huge applications that access massive datastores on large databases or mainframes.

Jeroen, I am not sure about the country you are currently residing in... I think the issue we are discussing is pretty related to geographic areas... What I mean in the above post is for Thailand, the country that I'm currently residing in.... If you are in other place rather than thailand, it might be easier to find a host in J2EE... but not in Thailand... Personally I do want to build up a personal website, using J2EE tech... But it is really expensive to hire a J2EE host in Thailand... So until now, I don't have one...
As Pradeep has just mentioned, people got more friendly with MS techs and they think that everything related to MS tech are easy to learn... Of course, I can also feel that fetching the concept of .Net is a lot easier than that of J2EE... I mean the learning rate can be higher... Hope you understand the situation in Thailand...
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Hi Ko Ko,
If you are using boardband, you can make your machine being online 7x24, and thus, you can use Tomcat and JBoss to hold your website.
Nick.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Nicholas Cheung:
Hi Ko Ko,
If you are using boardband, you can make your machine being online 7x24, and thus, you can use Tomcat and JBoss to hold your website.
Nick.

The problem is that I don't have broadband connection... It's really really expensive to apply for a broadband connection in Thailand... So there is no way to escape for me... Thailand is not that developed in technology... Hope you understand this situation... I do have plan to move to HK or Singapore, if I have chance... I don't know too why I was stuck in Thailand only...
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Of course I understand, cos I have no money to migrate into boardband world as well. Thus, all Websites I created are hosted in some free hosting.
Nick.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
You could easily host elsewhere of course, with the internet as it is the actual location of the server is not an issue.
There's JSP/Servlet hosting available for $10 or so a month. While not free, it's not all that much money either (one less beer a week at the pub will pay for it ).
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Jeroen Wenting:
There's JSP/Servlet hosting available for $10 or so a month. While not free, it's not all that much money either (one less beer a week at the pub will pay for it ).

IBM Cert sample test cost 10$... If I hire a host with $10 per month, I can take 12 IBM Certs within one year... Even $10 has meaning for developers in these days....
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Originally posted by Ko Ko Naing:

IBM Cert sample test cost 10$... If I hire a host with $10 per month, I can take 12 IBM Certs within one year... Even $10 has meaning for developers in these days....

Sure, but if paying a host $10 a month gets you a job paying $100 a month more than your current one you can buy 9 more certs a month on that $10 investment or 9 beers of course instead of 1
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
The issue seems become opportunity cost
Anyway, I do think you should find some hosting for JSP/Servlets.
Nick.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

OK, this discussion has gotten pretty off-topic. If you'd like to discuss hosting issues, please start a topic on that subject. Any further discussion in this topic should relate to the subject of Tags and Tag files.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Hans Bergsten
Author
Ranch Hand

Joined: Dec 01, 2003
Posts: 106
Originally posted by Ko Ko Naing:
So, Mr.Bergsten, do u think that evolution of EL and various implementation of Custom Tags will make other non-J2EE(PHP,ASP) developers interested in JSP 2.0 techonology?
I'm not sure about in U.S.? but here in Thailand, the world of small- and medium-sized web app is dominated by PHP and ASP(not .Net)... But in Enterprise application, they do prefer J2EE or .Net... It seems that there are a lot of freelance works on such small- and medium-sized application and it seems like they are able to beat J2EE in those areas...
But now JSP 2.0 is out and EL is evolved... I think this will surely impact the current market share of J2EE in Thailand...
Mr.Bergsten, what is your opinion about the JSP 2.0 and small/medium-sized web app?
Thanks for being here...


As Bear Bibeault pointed out, this discussion is off-topic for this thread, so I keep my reply short. If you want to discuss it further, please start a new thread with an appropriate header.
My opinions on this are pretty much the same as those expressed by Nicholas Cheung and Jeroen Wenting--most technology choices are made by management, based on the companies existing IT environment (OS etc.) and IT staff skills), rather than purely on the merits of a specific technology. Freelancers in turn pick the technologies that give them most jobs and/or the highest pay, which is usually the same technolgies as the major companies have standardized on.
The fact that JSP is becoming easier to use hopefully helps companies motivate a migration when they need to solve real problems with their existing technologies, so it may have a long term effect on the adoption rate but probably not much so short term.
 
Don't get me started about those stupid light bulbs.
 
subject: To Hans: Classic Tag, Simple Tag and Tag files
 
Similar Threads
About scriplet in tag bodies
allowable body-content values
Default Body Content
Simple and Classic tags understanding
So where are scriptlets never allowed?