Skip to main content

Facelets templating and JSF

2 replies [Last post]
jkchristensen
Offline
Joined: 2008-02-11
Points: 0

I have a Facelets template that looks like this (the CDATA tag is just there to make it readable on the forum):

---

Default Title

]]>
---

I have placed the body tag in the template. Several pages use this template.

Now the questions:

1) Is it possible to add something to the onLoad parameter of the body tag from a jsf page that uses this template without modifying the template? What I need is to have some pages (but not all) that uses this template to call a Javascript function when the page has loaded.

2) Is it possible to add content to the head tag from a jsf page that uses this template?

If 1) or 2) this is not possible what would be the best template structure to archieve this?

I am using JSF 1.2 and Facelets 1.1.14.

I would appreciate any advice or answers you may have.

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ed Burns

>>>>> On Wed, 09 Jun 2010 02:58:10 PDT, webtier@javadesktop.org said:

JC> 1) Is it possible to add something to the onLoad parameter of the
JC> body tag from a jsf page that uses this template without modifying
JC> the template? What I need is to have some pages (but not all) that
JC> uses this template to call a Javascript function when the page has
JC> loaded.

If you were using JSF2, the resource relocation feature might do what
you want. Since you are using JSF 1.2, I recommend this:

* Because you are using Facelets, you can have EL expressions just
hangin' out in the page, outside of outputText tags.

* Therefore, you can have EL like this in your template

* Just make sure that expression evaluates to what you want at page
execution time.

JC> 2) Is it possible to add content to the head tag from a jsf page
JC> that uses this template?

I think the same approach might work in that case.

JC> If 1) or 2) this is not possible what would be the best template
JC> structure to archieve this?

Try what I suggested first and let us know if it works for you.

Ed

--
| edburns... | office: +1 650 633 7407
| homepage: | http://ridingthecrest.com/
| 22 Work Days Til JSF 2.1 Milestone 1

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

jkchristensen
Offline
Joined: 2008-02-11
Points: 0

Thanks for the reply.

I will try it out.