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

Page 156 in Sample Chapter of JavaSrver Pages

 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also when I took the SCWCD 1.4 Beta Exam, I saw this point... But it's not a big deal with the exam, so I ignore it...
In the last paragraph of the Page 156 in the chapter-11 of the book said the following...

You can therefore implement the actions as tag files initially (because it�s easier) and convert them to Java classes later (maybe to gain better performance) without having to make any changes in the JSP pages that use them.

Does it mean that Classic Tags and Simple Tags implementation are better in performance than implementation custom tags using Tag Files? I'm just wondering why... Are tag files converted to the Java classes behind the scenes in the app serv? Or is it used as it is?
Mr. Bergsten, could you please explain a bit on this issue? I cannot stand asking you this question, since I was preparing for the exam... And u r here and it's very great that we have you here answering our doubts in your book... Thanks..
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ko Ko,
One of the reasons I think of is the pre-compliation issue.
For Classic and Simple Tags, we need to compile them before we can use them. And thus, they are already inside the memory of the container.
For tag files, like JSP, it is compiled on request. Maybe there are some ways, like JSP, that can pre-compile, but I am not sure.
Nick.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are tag files converted to the Java classes behind the scenes in the app serv?

Yes, they are.
 
Hans Bergsten
Author
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ko Ko Naing:
Also when I took the SCWCD 1.4 Beta Exam, I saw this point... But it's not a big deal with the exam, so I ignore it...
In the last paragraph of the Page 156 in the chapter-11 of the book said the following...

Does it mean that Classic Tags and Simple Tags implementation are better in performance than implementation custom tags using Tag Files? I'm just wondering why... Are tag files converted to the Java classes behind the scenes in the app serv? Or is it used as it is?
Mr. Bergsten, could you please explain a bit on this issue? I cannot stand asking you this question, since I was preparing for the exam... And u r here and it's very great that we have you here answering our doubts in your book... Thanks..

Maybe I should have punted on that comment, because the performance difference depends a lot on which container you use; some may use various tricks to make a tag file as performant as a hand-coded Java tag handler or even better.
Anyway, what I had in mind is that a tag file typically use a number of action elements to do its job, and the Java class generated from the tag file typically include code for creating a tag handler instance and setting its properties for each such action element. In theory, a hand-coded tag handler may use tighter code, such as directly calling utility methods implemented as regular Java classes instead. If there is a performance difference at all, it should be neglible for most web applications. In general, I recommend not to think too much about performance unless you've verified with a benchmark that it's really a problem.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:

Yes, they are.

which may or may not yield efficient Java code depending on how clever the generator is.
Most are not all that clever, skipping on optimisations in favour of simplicity of design. While not a big issue normally, if a tag gets complex it may yield a significant performance penalty compared to handcoded tags.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hans Bergsten:
In theory, a hand-coded tag handler may use tighter code, such as directly calling utility methods implemented as regular Java classes instead. If there is a performance difference at all, it should be neglible for most web applications. In general, I recommend not to think too much about performance unless you've verified with a benchmark that it's really a problem.

Is it like, in the real world web app, they usually neglect the performance issue that will come up by custom tags implementaion? I can see that, in almost all of the project that I've done in the past, we didn't care that much on tag implmentation performance issue... But, nowadays, there are many implementations of cutom tags... We might need to think about the performance issue, since there are many alternatives...
And also I can figure out that that kind of phrase in the book is making the reader to think about the performance issue, in case they might have doubt on the difference between classic tags, simple tags and tag files implementation...
Thank you very much for your explanation on it, Mr.Bergsten...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic