• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Simple vs Classic Tags - When ?

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, I read the following in a website "Simple tag handlers can be used only for tags that do not use scripting elements in attribute values or the tag body. Classic tag handlers must be used if scripting elements are required."
However, nothing of this sort is mentioned in the K & B book.
Is the above information correct ?
If not, then whats the actual difference between simple and classic tags except that simple tags are easier and simpler to use ? K &B states that classic tags used to be there in the previous version and hence supported. Any other reason such as the one stated above ?

Thanks
Devi
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sreedevi Vinod,

The body of a simple Tag is processed as a JspFragment , which can only contain template text and JSP action elements. so, it must not contain scriptlets or scriptlet expressions .
<body-content> for a SimpleTag cannot be JSP and defaults to "scriptless" .
A translation time should occur if the body content contains scriptlets or scriptlet expressions .

whereas,

a classic Tag doesnot have this restriction as its body is processed as BodyContent which is a subclass of JspWriter .

<body-content> for a ClassicTag defaults to "JSP"

Thanks and Regards,
Rufus
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Rufus ,
As you said

The body of a simple Tag is processed as a JspFragment , which can only contain template text and JSP action elements. so, it must not contain scriptlets or scriptlet expressions .



Can it contain EL expressions since scriptless body content means
it can contain standard actions and EL expressions ?

Thanks
Shiva
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

It can contain template text, EL, Standard and custom actions.

Thanks
 
J Johny Rufus
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shiva,

I perfectly agree with Narendra, as "Scriptless" bars the usage of two things

1. scriptlets <% %> and
2. scriptlet expressions <%= %>

Thanks and Regards,
Rufus
 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your replies. Can you also tell me, any cases where we would prefer to use simple tags instead of classic tags ?

-Devi
[ July 25, 2005: Message edited by: Sreedevi Vinod ]
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by J Johny Rufus:
Hi Shiva,

I perfectly agree with Narendra, as "Scriptless" bars the usage of two things

1. scriptlets <% %> and
2. scriptlet expressions <%= %>

Thanks and Regards,
Rufus


und what is about this <%! String Hi_you_declaration!!! %>
compile or not compile??
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when they say no script is allowed, I would think anything which starts like <%...
is not allowed.

Now that makes me wonder if a jsp comment is allowed.. like
<%!-- ......

any comments?

regards,
Brian
 
sergio mendez-rueda
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Brian Percival:
when they say no script is allowed, I would think anything which starts like <%...
is not allowed.

Now that makes me wonder if a jsp comment is allowed.. like
<%!-- ......

any comments?

regards,
Brian


Hi,
scripletless means:
no declaration, expresion or scriplet
but <%-- this is a comment --%>
This is a comment.
O.k?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic