Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Generating <script> tag from Custom JSF Tag

 
Kashif Nazar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to JSF Custom Tags. I developed a Custom tag. It's quite a fun to make your own custom tags . Now I have to use some javascript for my custom components. The inline javascript calls are no issue for me. But I want my javascript be embedded in a <script> tag automatically. So that I don't have to explicitly add my javascript into <script> tag, instead, it is automatically included in the page where my tags are being used. How can this be achieved?

Regards,
Kashif
 
Jason Lee
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[quote=Kashif Nazar]Hi,

I am new to JSF Custom Tags. I developed a Custom tag. It's quite a fun to make your own custom tags :) . Now I have to use some javascript for my custom components. The inline javascript calls are no issue for me. But I want my javascript be embedded in a <script> tag automatically. So that I don't have to explicitly add my javascript into <script> tag, instead, it is automatically included in the page where my tags are being used. How can this be achieved?[/quote]

I'm not sure I understand your question. Are you wanting to add your custom JS to <head>? If so, you would user <h:outputScript>. If you're wanting something easier for inline JS from your composite component (which is what I'm assuming you mean by "custom tag?"), I'm not aware of anything to help there. A component for that seems like over kill. :)

 
satya anvesh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to include a .js script in a jsf page conditionally. That is, if a bean condition is true, one.js should be included otherwise two.js should be included. I am using JSF 1.1 so it does not support 'rendered' tag in <f:verbatim>. How can I achieve this? Thanks for your help.

Anvesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!