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

Simple vs Classic Tags - When ?

 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • 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
 
J Johny Rufus
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • 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
 
shiva viswanathan
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • 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
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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 ]
 
sergio mendez-rueda
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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??
 
Brian Percival
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic