You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Thomas Gaudin <th...@wanadoo.fr> on 2006/01/22 11:34:19 UTC

Myfaces and javascript

Hi,

I must be missing something obvious but I am stuck with this...
Is there a myFaces tag equivalent to <afh:script> in ADF faces?
I don't understand how to include a javascript file without hardcoding 
the context path :
I have a js script file in /scripts/myscript.js, how to include it so as 
it works if the application is deployed in the root context ("/") or in 
another context ("/mycontext/) ?

Also, anybody knows how to localize a message displayed in a alert() 
javascript popup?

Thanks,

Thomas


Re: Myfaces and javascript

Posted by Matthias Wessendorf <mw...@gmail.com>.
Hi Thomas-

> For style sheets I am using the tomahawk <t:stylesheet> tag but there do
> not seem to have <t:script> tag...
> Aby ideas?

in sandbox of myfaces (only sources) there is a <s:script> component.

I needed such a component too ;-)
So check the sources and try the component.

Also, I recommend using (or looking) at the sandbox stuff.
Contains nice goodies!

-Matthias



> Thanks,
>
> Thomas
>
> Hansjörg Meuschel a écrit :
> > Hi, I have something like
> >
> > <f:verbatim>
> >       <script language='text/javascript'
> > src='<%=request.getContextPath()%>/path/to/your/script.js'/>
> > </f:verbatim>
> > or
> > <link rel="stylesheet" type="text/css"
> > href="<%=request.getContextPath()%>/myfaces.css" />
> >
> >
> > For localized javascript popup messages I have for example
> > <t:commandButton value="Message"
> > onclick="alert('#{bundle.theMessage}');"/>
> >
> > Hope this helps you,
> > I've no idea about other solutions...
> >
> > Regards
> > Hans
> >
> >
> > Thomas Gaudin wrote:
> >
> >> Hi,
> >>
> >> I must be missing something obvious but I am stuck with this...
> >> Is there a myFaces tag equivalent to <afh:script> in ADF faces?
> >> I don't understand how to include a javascript file without
> >> hardcoding the context path :
> >> I have a js script file in /scripts/myscript.js, how to include it so
> >> as it works if the application is deployed in the root context ("/")
> >> or in another context ("/mycontext/) ?
> >>
> >> Also, anybody knows how to localize a message displayed in a alert()
> >> javascript popup?
> >>
> >> Thanks,
> >>
> >> Thomas
> >
> > ---------------------------------------------------------------------------------------
> >
> > Wanadoo vous informe que cet  e-mail a ete controle par l'anti-virus
> > mail. Aucun virus connu a ce jour par nos services n'a ete detecte.
> >
> >
> >
> >
> >
>
>
>


--
Matthias Wessendorf
Zülpicher Wall 12, 239
50674 Köln
http://www.wessendorf.net
mwessendorf-at-gmail-dot-com

Re: Myfaces and javascript

Posted by Thomas Gaudin <th...@wanadoo.fr>.
Thanks Hansjörg, performing the alert stuff as you advise should do the 
trick.

Unfortunatly I am using facelets instead of JSP so the 
<%=request.getContextPath()%> method is not possible for me.
For style sheets I am using the tomahawk <t:stylesheet> tag but there do 
not seem to have <t:script> tag...
Aby ideas?

Thanks,

Thomas

Hansjörg Meuschel a écrit :
> Hi, I have something like
>
> <f:verbatim>
>       <script language='text/javascript' 
> src='<%=request.getContextPath()%>/path/to/your/script.js'/>
> </f:verbatim>
> or
> <link rel="stylesheet" type="text/css" 
> href="<%=request.getContextPath()%>/myfaces.css" />
>
>
> For localized javascript popup messages I have for example
> <t:commandButton value="Message" 
> onclick="alert('#{bundle.theMessage}');"/>
>
> Hope this helps you,
> I've no idea about other solutions...
>
> Regards
> Hans
>
>
> Thomas Gaudin wrote:
>
>> Hi,
>>
>> I must be missing something obvious but I am stuck with this...
>> Is there a myFaces tag equivalent to <afh:script> in ADF faces?
>> I don't understand how to include a javascript file without 
>> hardcoding the context path :
>> I have a js script file in /scripts/myscript.js, how to include it so 
>> as it works if the application is deployed in the root context ("/") 
>> or in another context ("/mycontext/) ?
>>
>> Also, anybody knows how to localize a message displayed in a alert() 
>> javascript popup?
>>
>> Thanks,
>>
>> Thomas
>
> --------------------------------------------------------------------------------------- 
>
> Wanadoo vous informe que cet  e-mail a ete controle par l'anti-virus 
> mail. Aucun virus connu a ce jour par nos services n'a ete detecte.
>
>
>
>
>



Re: Myfaces and javascript

Posted by Hansjörg Meuschel <hj...@gmx.de>.
Hi, I have something like

<f:verbatim>
       <script language='text/javascript' 
src='<%=request.getContextPath()%>/path/to/your/script.js'/>
</f:verbatim>
or
<link rel="stylesheet" type="text/css" 
href="<%=request.getContextPath()%>/myfaces.css" />


For localized javascript popup messages I have for example
<t:commandButton value="Message" onclick="alert('#{bundle.theMessage}');"/>

Hope this helps you,
I've no idea about other solutions...

Regards
Hans


Thomas Gaudin wrote:

> Hi,
>
> I must be missing something obvious but I am stuck with this...
> Is there a myFaces tag equivalent to <afh:script> in ADF faces?
> I don't understand how to include a javascript file without hardcoding 
> the context path :
> I have a js script file in /scripts/myscript.js, how to include it so 
> as it works if the application is deployed in the root context ("/") 
> or in another context ("/mycontext/) ?
>
> Also, anybody knows how to localize a message displayed in a alert() 
> javascript popup?
>
> Thanks,
>
> Thomas