jSF and JavaScript

Hi ,I am new to JSF,and just in the process of learning.I have a .js file (that has a menu design page)i want to call this .js file inside my JSF page.Please help me how should i go abt including them in my JSF pagesThanks in advance
[268 byte] By [svs_1623a] at [2007-11-26 17:50:27]
# 1

Hi,

there are a lot of frameworks and componet toolkits that do this in various ways, and I am sure you will get lots of suggestions for different frameworks etc.

But if you are looking at a simple way to do this for basic cases, and just using some features in JSF, then you could use the phase listener approach, outlined at

https://blueprints.dev.java.net/bpcatalog/ee5/ajax/phaselistener.html

hth,

Sean

> Hi ,

> I am new to JSF,and just in the process of learning.I

> have a .js file (that has a menu design page)

>

> i want to call this .js file inside my JSF page.

>

> Please help me how should i go abt including them in

> my JSF pages

>

> Thanks in advance

seanbrydona at 2007-7-9 5:02:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Maybe it's sufficient to place a script component inside the head component. With JSC this is done by

<ui:head ...>

<ui:script binding="#{MyBean.script1}" id="script1" url="/resources/script.js"/>

</ui:head>

This is rendered as a normal <script> tag in the client-side html page.

Ingmara at 2007-7-9 5:02:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You can include the js script as Ingmar suggests ...If you've already done this, can you be more specific about the code issue?
wbossonsa at 2007-7-9 5:02:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I am having a similar problem as svs_1623. Only I am going to go into a little more detail.

I have a menu for a webpage that was originally built using html and javascript. I need to convert it to be used with JSF and ADF. In the html, the menu items used an unordered list inside of a div tag.

It looks something like this:

<div id="shademenu" class="shadetabs">

<ul>

<li><a href="#" rel="dropmenu0">Item1</a></li>

<li><a href="#" rel="dropmenu1" rev="testfield">Item2</a></li>

<li><a href="#" rel="dropmenu2">Item3</a></li>

<li><a href="#" rel="dropmenu3">Item4</a></li>

<li><a href="#" rel="dropmenu4">Item5</a></li>

<li><a href="#" rel="dropmenu5">Item 6</a></li>

</ul>

</div>

AND

the submenu(s) have links that look something like:

<div id="dropmenu0" class="dropmenudiv">

<a href="#">Data</a>

<a href="#">Data</a>

<a href="#">Data</a>

</div>

The suggestions that you guys have made wouldn't completely solve my problem... My problem isn't putting the script in the jsf jsp, its creating the links that are in the drop down menu... They use un ordered lists...and <DIV> tags... Any help or guidence is appreciated.

danielwconnera at 2007-7-9 5:02:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
What links do you need to create?Why do you have to change the existing menu?What means "to convert it to be used with JSF and ADF"?Do you want to invoke action methods, action listeners or simply use external links?I can see only anchors in your code.
Ingmara at 2007-7-9 5:02:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...