Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

tag file - tagdependent and scripting

 
Radmika Arunachalam
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have sample code as below..

// Header.tag


// test.jsp


I getting "${test} in teh browser but not the scripting ("Hi Viewers How are u?").. Since my body-content is tagdependent, why it is not displaying scripting? I know in HFSJ given "scripting not alowed in the body of the tag files" but what about if said tagdependent - is it not mean body is implementation dependent and processed by tag itself..

Any Idea why it is behaving like this? I am not able to find topics related to this in spec.. Thanks in advance

Thanks
Radmika
 
Murali Krishna Vyamasani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Radmika,
When you say <%@ tag body-content="tagdependent" %> the body content is treated like plain text so EL,tags and scripts will not be evaluated. So the El tag ${text} is being printed because it is just treated as normal text.

This code <%= "Hi Viewers How are u? " %> is an expression so it is not being evaluated.

U can also refer HFSJ pg.498 for information on this.

Ranchers correct me if I am wrong.

Murali.
 
Murali Krishna Vyamasani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi radmika,
I am sorry. I just realised suddenly that when u say tagdependent everything in the body should be treated as normal text.
So part of my statement is wrong

" So the El tag ${text} is being printed because it is just treated as normal text. "

It should also be ignored. I don't know why it is printing.

The output that you got would be correct if the body-content were scriptless which is the default value.

Hope somebody clears it.

Murali.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!