You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Leis <ma...@gmx.net> on 2010/04/01 10:51:59 UTC

javascript error "jsf is not defined"

Hi,

I have this piece of code:
<h:commandLink value="#{msg.adminPageLogFileTableDelete}" action="#{adminPage.deleteLogFile}" onclick="confirm('Are you sure?')"/>

When I click the link, I get an JavaScript error: jsf is not defined

What does this mean?

I am using myfaces 2.0.0-beta-3

Any help is appreciated :)
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Re: javascript error "jsf is not defined"

Posted by Werner Punz <we...@gmail.com>.
Actually afaik you still need a faces-config, but in many cases it can 
be left blank or you just have a few lines of xml because you wont have 
too many artifacts anymore which still
need xml registration. Most of the day to day stuff is now annotations.
But there are exceptions, which is a little bit annoying.


Werner


Am 07.04.10 13:56, schrieb Matthias Leis:
> You are right about the view handler. I forgot that JSF2 doesn't need afaces-config anymore. But I need it anyway for registering a phase listener. Anyway, if I remove the view handler from the faces-config, all I get from my webapp is a blank page and no errors. Do I have to define a view-handler if I use a faces-config file or does JSF just use the dafault view handler?
> -------- Original-Nachricht --------
>> Datum: Wed, 07 Apr 2010 08:54:02 +0200
>> Von: Werner Punz<we...@gmail.com>
>> An: users@myfaces.apache.org
>> Betreff: Re: javascript error "jsf is not defined"
>
>> Am 07.04.10 08:14, schrieb Matthias Leis:
>>> Hi Jakob,
>>>
>>> I guess I use the built-in facelets. At least this is the code from
>> faces-config:
>>> <view-handler>
>>>         com.sun.facelets.FaceletViewHandler
>>> </view-handler>
>> Wrong view handler... the jsf2 one is not under com.sun, but under
>> javax.faces.view.facelets and it is initialized automatically if you use
>> myfaces and the jsf2 facelets (no further configuration is needed)
>> Com sun is the old Facelet 1.x stuff and the new tags cannot work under
>> it due to the extensions in the jsf2 lifecycle and view handler api.
>> So it is either old facelets or the jsf2 one but not a mix of both, sort
>> of a hard break introduced by the namespace change from com.sun into
>> javax.facelets and due to the api changes, but better once a hard break
>> from old habits than having endless pain :-)
>>
>> Basically if you run in a pure jsf2 environment you can start to use
>> facelets without additional configuration on the faces-config side.
>>
>> Werner
>>
>



Re: javascript error "jsf is not defined"

Posted by Jakob Korherr <ja...@gmail.com>.
Hi,

In JSF 2.0 you don't have to configure a view handler. It will decide
whether to use the new Facelets- or the JSP-ViewDeclarationLanguage in the
default ViewHandlerImpl.

Regards,
Jakob

2010/4/7 Matthias Leis <ma...@gmx.net>

> You are right about the view handler. I forgot that JSF2 doesn't need
> afaces-config anymore. But I need it anyway for registering a phase
> listener. Anyway, if I remove the view handler from the faces-config, all I
> get from my webapp is a blank page and no errors. Do I have to define a
> view-handler if I use a faces-config file or does JSF just use the dafault
> view handler?
> -------- Original-Nachricht --------
> > Datum: Wed, 07 Apr 2010 08:54:02 +0200
> > Von: Werner Punz <we...@gmail.com>
> > An: users@myfaces.apache.org
> > Betreff: Re: javascript error "jsf is not defined"
>
> > Am 07.04.10 08:14, schrieb Matthias Leis:
> > > Hi Jakob,
> > >
> > > I guess I use the built-in facelets. At least this is the code from
> > faces-config:
> > > <view-handler>
> > >        com.sun.facelets.FaceletViewHandler
> > > </view-handler>
> > Wrong view handler... the jsf2 one is not under com.sun, but under
> > javax.faces.view.facelets and it is initialized automatically if you use
> > myfaces and the jsf2 facelets (no further configuration is needed)
> > Com sun is the old Facelet 1.x stuff and the new tags cannot work under
> > it due to the extensions in the jsf2 lifecycle and view handler api.
> > So it is either old facelets or the jsf2 one but not a mix of both, sort
> > of a hard break introduced by the namespace change from com.sun into
> > javax.facelets and due to the api changes, but better once a hard break
> > from old habits than having endless pain :-)
> >
> > Basically if you run in a pure jsf2 environment you can start to use
> > facelets without additional configuration on the faces-config side.
> >
> > Werner
> >
>
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>

Re: javascript error "jsf is not defined"

Posted by Matthias Leis <ma...@gmx.net>.
You are right about the view handler. I forgot that JSF2 doesn't need afaces-config anymore. But I need it anyway for registering a phase listener. Anyway, if I remove the view handler from the faces-config, all I get from my webapp is a blank page and no errors. Do I have to define a view-handler if I use a faces-config file or does JSF just use the dafault view handler?
-------- Original-Nachricht --------
> Datum: Wed, 07 Apr 2010 08:54:02 +0200
> Von: Werner Punz <we...@gmail.com>
> An: users@myfaces.apache.org
> Betreff: Re: javascript error "jsf is not defined"

> Am 07.04.10 08:14, schrieb Matthias Leis:
> > Hi Jakob,
> >
> > I guess I use the built-in facelets. At least this is the code from
> faces-config:
> > <view-handler>
> >        com.sun.facelets.FaceletViewHandler
> > </view-handler>
> Wrong view handler... the jsf2 one is not under com.sun, but under 
> javax.faces.view.facelets and it is initialized automatically if you use 
> myfaces and the jsf2 facelets (no further configuration is needed)
> Com sun is the old Facelet 1.x stuff and the new tags cannot work under 
> it due to the extensions in the jsf2 lifecycle and view handler api.
> So it is either old facelets or the jsf2 one but not a mix of both, sort 
> of a hard break introduced by the namespace change from com.sun into 
> javax.facelets and due to the api changes, but better once a hard break 
> from old habits than having endless pain :-)
> 
> Basically if you run in a pure jsf2 environment you can start to use 
> facelets without additional configuration on the faces-config side.
> 
> Werner
> 

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Re: javascript error "jsf is not defined"

Posted by Werner Punz <we...@gmail.com>.
Am 07.04.10 08:14, schrieb Matthias Leis:
> Hi Jakob,
>
> I guess I use the built-in facelets. At least this is the code from faces-config:
> <view-handler>
>        com.sun.facelets.FaceletViewHandler
> </view-handler>
Wrong view handler... the jsf2 one is not under com.sun, but under 
javax.faces.view.facelets and it is initialized automatically if you use 
myfaces and the jsf2 facelets (no further configuration is needed)
Com sun is the old Facelet 1.x stuff and the new tags cannot work under 
it due to the extensions in the jsf2 lifecycle and view handler api.
So it is either old facelets or the jsf2 one but not a mix of both, sort 
of a hard break introduced by the namespace change from com.sun into 
javax.facelets and due to the api changes, but better once a hard break 
from old habits than having endless pain :-)

Basically if you run in a pure jsf2 environment you can start to use 
facelets without additional configuration on the faces-config side.

Werner



Re: javascript error "jsf is not defined"

Posted by Matthias Leis <ma...@gmx.net>.
Hi Jakob,

I guess I use the built-in facelets. At least this is the code from faces-config:
<view-handler>
      com.sun.facelets.FaceletViewHandler
</view-handler>

Matthias
-------- Original-Nachricht --------
> Datum: Thu, 1 Apr 2010 19:53:11 +0200
> Von: Jakob Korherr <ja...@gmail.com>
> An: MyFaces Discussion <us...@myfaces.apache.org>
> Betreff: Re: javascript error "jsf is not defined"

> Hi Matthias,
> 
> Are you using the built-in facelets or are you using facelets-1.1.x?
> 
> You're welcome! I'm glad I could help.
> 
> Danke - ebenfalls fröhliche Ostern :)
> 
> Jakob
> 
> 2010/4/1 Matthias Leis <ma...@gmx.net>
> 
> > Hi Jakob,
> >
> > I'm already using Facelets (and MyFaces 2.0).
> > I have no clue, why h:outputScript shouldn't be defined... anyway, I
> > imported the script as you suggested and it works perfectly! Many thanks
> and
> > happy Easter! (oder einfach fröhliche Ostern! ;) )
> > -------- Original-Nachricht --------
> > > Datum: Thu, 1 Apr 2010 14:16:04 +0200
> > > Von: Jakob Korherr <ja...@gmail.com>
> > > An: MyFaces Discussion <us...@myfaces.apache.org>
> > > Betreff: Re: javascript error "jsf is not defined"
> >
> > > Hi Matthias,
> > >
> > > You're using MyFaces 2.0 and JSP, right?
> > >
> > > The problem is that h:outputScript only works for facelets and not for
> > > JSP.
> > > I would recommend that you use facelets instead of JSP, because in JSF
> > 2.0
> > > JSP is seen as a legacy technology which does not include many of the
> new
> > > features. Furthermore it is easy to change!
> > >
> > > If you do want to use JSP, you will have to include the script
> directly
> > > rather than using h:outputScript. This will look something like this:
> > >
> > > <script type="text/javascript"
> > >
> >
> src="/test-webapp/javax.faces.resource/jsf.js.jsf?ln=javax.faces"></script>
> > >
> > > But note that my application prefix is "test-webapp" and my used
> mapping
> > > is
> > > *.jsf - I guess you will have to change those settings!
> > >
> > > Regards,
> > > Jakob
> > >
> > >
> > > 2010/4/1 Matthias Leis <ma...@gmx.net>
> > >
> > > > Hi Jakob,
> > > >
> > > > thanks for your quick reply. I tried
> > > > <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> > > > and I get
> > > > Tag Library supports namespace: http://java.sun.com/jsf/html, but no
> > tag
> > > > was defined for name: outputScript
> > > >
> > > > I know, that outputScript is defined, but how to tell it JSF? ;) How
> to
> > > > update my taglib?
> > > >
> > > > I'm almost sorry for this question :(
> > > >
> > > > Thanks!
> > > > -------- Original-Nachricht --------
> > > > > Datum: Thu, 1 Apr 2010 11:48:06 +0200
> > > > > Von: Jakob Korherr <ja...@gmail.com>
> > > > > An: MyFaces Discussion <us...@myfaces.apache.org>
> > > > > Betreff: Re: javascript error "jsf is not defined"
> > > >
> > > > > Hi Matthias,
> > > > >
> > > > > If you have some javascript in onclick we have to use the
> > > > jsf.util.chain()
> > > > > function to chain your javascript with the MyFaces javascript. For
> > > that
> > > > to
> > > > > work we need the JSF javascript library in the view. This include
> > > > _should_
> > > > > happen automatically, but it seems that it does not.
> > > > >
> > > > > I'll take a look at this one! For now you can include the
> following
> > in
> > > > > your
> > > > > view to include the JSF javascript library manually and thus to
> make
> > > it
> > > > > work:
> > > > >
> > > > > <h:outputScript name="jsf.js" library="javax.faces"
> target="head"/>
> > > > >
> > > > > Regards,
> > > > > Jakob
> > > > >
> > > > > 2010/4/1 Matthias Leis <ma...@gmx.net>
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I have this piece of code:
> > > > > > <h:commandLink value="#{msg.adminPageLogFileTableDelete}"
> > > > > > action="#{adminPage.deleteLogFile}" onclick="confirm('Are you
> > > > sure?')"/>
> > > > > >
> > > > > > When I click the link, I get an JavaScript error: jsf is not
> > defined
> > > > > >
> > > > > > What does this mean?
> > > > > >
> > > > > > I am using myfaces 2.0.0-beta-3
> > > > > >
> > > > > > Any help is appreciated :)
> > > > > > --
> > > > > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > > > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > > > > >
> > > >
> > > > --
> > > > Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
> > > > jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser
> > > >
> >
> > --
> > GMX.at - Österreichs FreeMail-Dienst mit über 2 Mio Mitgliedern
> > E-Mail, SMS & mehr! Kostenlos: http://portal.gmx.net/de/go/atfreemail
> >

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Re: javascript error "jsf is not defined"

Posted by Jakob Korherr <ja...@gmail.com>.
Hi Matthias,

Are you using the built-in facelets or are you using facelets-1.1.x?

You're welcome! I'm glad I could help.

Danke - ebenfalls fröhliche Ostern :)

Jakob

2010/4/1 Matthias Leis <ma...@gmx.net>

> Hi Jakob,
>
> I'm already using Facelets (and MyFaces 2.0).
> I have no clue, why h:outputScript shouldn't be defined... anyway, I
> imported the script as you suggested and it works perfectly! Many thanks and
> happy Easter! (oder einfach fröhliche Ostern! ;) )
> -------- Original-Nachricht --------
> > Datum: Thu, 1 Apr 2010 14:16:04 +0200
> > Von: Jakob Korherr <ja...@gmail.com>
> > An: MyFaces Discussion <us...@myfaces.apache.org>
> > Betreff: Re: javascript error "jsf is not defined"
>
> > Hi Matthias,
> >
> > You're using MyFaces 2.0 and JSP, right?
> >
> > The problem is that h:outputScript only works for facelets and not for
> > JSP.
> > I would recommend that you use facelets instead of JSP, because in JSF
> 2.0
> > JSP is seen as a legacy technology which does not include many of the new
> > features. Furthermore it is easy to change!
> >
> > If you do want to use JSP, you will have to include the script directly
> > rather than using h:outputScript. This will look something like this:
> >
> > <script type="text/javascript"
> >
> src="/test-webapp/javax.faces.resource/jsf.js.jsf?ln=javax.faces"></script>
> >
> > But note that my application prefix is "test-webapp" and my used mapping
> > is
> > *.jsf - I guess you will have to change those settings!
> >
> > Regards,
> > Jakob
> >
> >
> > 2010/4/1 Matthias Leis <ma...@gmx.net>
> >
> > > Hi Jakob,
> > >
> > > thanks for your quick reply. I tried
> > > <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> > > and I get
> > > Tag Library supports namespace: http://java.sun.com/jsf/html, but no
> tag
> > > was defined for name: outputScript
> > >
> > > I know, that outputScript is defined, but how to tell it JSF? ;) How to
> > > update my taglib?
> > >
> > > I'm almost sorry for this question :(
> > >
> > > Thanks!
> > > -------- Original-Nachricht --------
> > > > Datum: Thu, 1 Apr 2010 11:48:06 +0200
> > > > Von: Jakob Korherr <ja...@gmail.com>
> > > > An: MyFaces Discussion <us...@myfaces.apache.org>
> > > > Betreff: Re: javascript error "jsf is not defined"
> > >
> > > > Hi Matthias,
> > > >
> > > > If you have some javascript in onclick we have to use the
> > > jsf.util.chain()
> > > > function to chain your javascript with the MyFaces javascript. For
> > that
> > > to
> > > > work we need the JSF javascript library in the view. This include
> > > _should_
> > > > happen automatically, but it seems that it does not.
> > > >
> > > > I'll take a look at this one! For now you can include the following
> in
> > > > your
> > > > view to include the JSF javascript library manually and thus to make
> > it
> > > > work:
> > > >
> > > > <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> > > >
> > > > Regards,
> > > > Jakob
> > > >
> > > > 2010/4/1 Matthias Leis <ma...@gmx.net>
> > > >
> > > > > Hi,
> > > > >
> > > > > I have this piece of code:
> > > > > <h:commandLink value="#{msg.adminPageLogFileTableDelete}"
> > > > > action="#{adminPage.deleteLogFile}" onclick="confirm('Are you
> > > sure?')"/>
> > > > >
> > > > > When I click the link, I get an JavaScript error: jsf is not
> defined
> > > > >
> > > > > What does this mean?
> > > > >
> > > > > I am using myfaces 2.0.0-beta-3
> > > > >
> > > > > Any help is appreciated :)
> > > > > --
> > > > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > > > >
> > >
> > > --
> > > Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
> > > jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser
> > >
>
> --
> GMX.at - Österreichs FreeMail-Dienst mit über 2 Mio Mitgliedern
> E-Mail, SMS & mehr! Kostenlos: http://portal.gmx.net/de/go/atfreemail
>

Re: javascript error "jsf is not defined"

Posted by Werner Punz <we...@gmail.com>.
Funny why you ran into this error, I have used the h:outputScript many 
times for testing, never ran into this issue.
Anyway, glad it works now for you.


Werner

Am 01.04.10 14:48, schrieb Matthias Leis:
> Hi Jakob,
>
> I'm already using Facelets (and MyFaces 2.0).
> I have no clue, why h:outputScript shouldn't be defined... anyway, I imported the script as you suggested and it works perfectly! Many thanks and happy Easter! (oder einfach fröhliche Ostern! ;) )
> -------- Original-Nachricht --------
>> Datum: Thu, 1 Apr 2010 14:16:04 +0200
>> Von: Jakob Korherr<ja...@gmail.com>
>> An: MyFaces Discussion<us...@myfaces.apache.org>
>> Betreff: Re: javascript error "jsf is not defined"
>
>> Hi Matthias,
>>
>> You're using MyFaces 2.0 and JSP, right?
>>
>> The problem is that h:outputScript only works for facelets and not for
>> JSP.
>> I would recommend that you use facelets instead of JSP, because in JSF 2.0
>> JSP is seen as a legacy technology which does not include many of the new
>> features. Furthermore it is easy to change!
>>
>> If you do want to use JSP, you will have to include the script directly
>> rather than using h:outputScript. This will look something like this:
>>
>> <script type="text/javascript"
>> src="/test-webapp/javax.faces.resource/jsf.js.jsf?ln=javax.faces"></script>
>>
>> But note that my application prefix is "test-webapp" and my used mapping
>> is
>> *.jsf - I guess you will have to change those settings!
>>
>> Regards,
>> Jakob
>>
>>
>> 2010/4/1 Matthias Leis<ma...@gmx.net>
>>
>>> Hi Jakob,
>>>
>>> thanks for your quick reply. I tried
>>> <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
>>> and I get
>>> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag
>>> was defined for name: outputScript
>>>
>>> I know, that outputScript is defined, but how to tell it JSF? ;) How to
>>> update my taglib?
>>>
>>> I'm almost sorry for this question :(
>>>
>>> Thanks!
>>> -------- Original-Nachricht --------
>>>> Datum: Thu, 1 Apr 2010 11:48:06 +0200
>>>> Von: Jakob Korherr<ja...@gmail.com>
>>>> An: MyFaces Discussion<us...@myfaces.apache.org>
>>>> Betreff: Re: javascript error "jsf is not defined"
>>>
>>>> Hi Matthias,
>>>>
>>>> If you have some javascript in onclick we have to use the
>>> jsf.util.chain()
>>>> function to chain your javascript with the MyFaces javascript. For
>> that
>>> to
>>>> work we need the JSF javascript library in the view. This include
>>> _should_
>>>> happen automatically, but it seems that it does not.
>>>>
>>>> I'll take a look at this one! For now you can include the following in
>>>> your
>>>> view to include the JSF javascript library manually and thus to make
>> it
>>>> work:
>>>>
>>>> <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
>>>>
>>>> Regards,
>>>> Jakob
>>>>
>>>> 2010/4/1 Matthias Leis<ma...@gmx.net>
>>>>
>>>>> Hi,
>>>>>
>>>>> I have this piece of code:
>>>>> <h:commandLink value="#{msg.adminPageLogFileTableDelete}"
>>>>> action="#{adminPage.deleteLogFile}" onclick="confirm('Are you
>>> sure?')"/>
>>>>>
>>>>> When I click the link, I get an JavaScript error: jsf is not defined
>>>>>
>>>>> What does this mean?
>>>>>
>>>>> I am using myfaces 2.0.0-beta-3
>>>>>
>>>>> Any help is appreciated :)
>>>>> --
>>>>> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
>>>>> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>>>>>
>>>
>>> --
>>> Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
>>> jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser
>>>
>



Re: javascript error "jsf is not defined"

Posted by Matthias Leis <ma...@gmx.net>.
Hi Jakob,

I'm already using Facelets (and MyFaces 2.0).
I have no clue, why h:outputScript shouldn't be defined... anyway, I imported the script as you suggested and it works perfectly! Many thanks and happy Easter! (oder einfach fröhliche Ostern! ;) )
-------- Original-Nachricht --------
> Datum: Thu, 1 Apr 2010 14:16:04 +0200
> Von: Jakob Korherr <ja...@gmail.com>
> An: MyFaces Discussion <us...@myfaces.apache.org>
> Betreff: Re: javascript error "jsf is not defined"

> Hi Matthias,
> 
> You're using MyFaces 2.0 and JSP, right?
> 
> The problem is that h:outputScript only works for facelets and not for
> JSP.
> I would recommend that you use facelets instead of JSP, because in JSF 2.0
> JSP is seen as a legacy technology which does not include many of the new
> features. Furthermore it is easy to change!
> 
> If you do want to use JSP, you will have to include the script directly
> rather than using h:outputScript. This will look something like this:
> 
> <script type="text/javascript"
> src="/test-webapp/javax.faces.resource/jsf.js.jsf?ln=javax.faces"></script>
> 
> But note that my application prefix is "test-webapp" and my used mapping
> is
> *.jsf - I guess you will have to change those settings!
> 
> Regards,
> Jakob
> 
> 
> 2010/4/1 Matthias Leis <ma...@gmx.net>
> 
> > Hi Jakob,
> >
> > thanks for your quick reply. I tried
> > <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> > and I get
> > Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag
> > was defined for name: outputScript
> >
> > I know, that outputScript is defined, but how to tell it JSF? ;) How to
> > update my taglib?
> >
> > I'm almost sorry for this question :(
> >
> > Thanks!
> > -------- Original-Nachricht --------
> > > Datum: Thu, 1 Apr 2010 11:48:06 +0200
> > > Von: Jakob Korherr <ja...@gmail.com>
> > > An: MyFaces Discussion <us...@myfaces.apache.org>
> > > Betreff: Re: javascript error "jsf is not defined"
> >
> > > Hi Matthias,
> > >
> > > If you have some javascript in onclick we have to use the
> > jsf.util.chain()
> > > function to chain your javascript with the MyFaces javascript. For
> that
> > to
> > > work we need the JSF javascript library in the view. This include
> > _should_
> > > happen automatically, but it seems that it does not.
> > >
> > > I'll take a look at this one! For now you can include the following in
> > > your
> > > view to include the JSF javascript library manually and thus to make
> it
> > > work:
> > >
> > > <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> > >
> > > Regards,
> > > Jakob
> > >
> > > 2010/4/1 Matthias Leis <ma...@gmx.net>
> > >
> > > > Hi,
> > > >
> > > > I have this piece of code:
> > > > <h:commandLink value="#{msg.adminPageLogFileTableDelete}"
> > > > action="#{adminPage.deleteLogFile}" onclick="confirm('Are you
> > sure?')"/>
> > > >
> > > > When I click the link, I get an JavaScript error: jsf is not defined
> > > >
> > > > What does this mean?
> > > >
> > > > I am using myfaces 2.0.0-beta-3
> > > >
> > > > Any help is appreciated :)
> > > > --
> > > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > > >
> >
> > --
> > Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
> > jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser
> >

-- 
GMX.at - Österreichs FreeMail-Dienst mit über 2 Mio Mitgliedern
E-Mail, SMS & mehr! Kostenlos: http://portal.gmx.net/de/go/atfreemail

Re: javascript error "jsf is not defined"

Posted by Jakob Korherr <ja...@gmail.com>.
Hi Matthias,

You're using MyFaces 2.0 and JSP, right?

The problem is that h:outputScript only works for facelets and not for JSP.
I would recommend that you use facelets instead of JSP, because in JSF 2.0
JSP is seen as a legacy technology which does not include many of the new
features. Furthermore it is easy to change!

If you do want to use JSP, you will have to include the script directly
rather than using h:outputScript. This will look something like this:

<script type="text/javascript"
src="/test-webapp/javax.faces.resource/jsf.js.jsf?ln=javax.faces"></script>

But note that my application prefix is "test-webapp" and my used mapping is
*.jsf - I guess you will have to change those settings!

Regards,
Jakob


2010/4/1 Matthias Leis <ma...@gmx.net>

> Hi Jakob,
>
> thanks for your quick reply. I tried
> <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> and I get
> Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag
> was defined for name: outputScript
>
> I know, that outputScript is defined, but how to tell it JSF? ;) How to
> update my taglib?
>
> I'm almost sorry for this question :(
>
> Thanks!
> -------- Original-Nachricht --------
> > Datum: Thu, 1 Apr 2010 11:48:06 +0200
> > Von: Jakob Korherr <ja...@gmail.com>
> > An: MyFaces Discussion <us...@myfaces.apache.org>
> > Betreff: Re: javascript error "jsf is not defined"
>
> > Hi Matthias,
> >
> > If you have some javascript in onclick we have to use the
> jsf.util.chain()
> > function to chain your javascript with the MyFaces javascript. For that
> to
> > work we need the JSF javascript library in the view. This include
> _should_
> > happen automatically, but it seems that it does not.
> >
> > I'll take a look at this one! For now you can include the following in
> > your
> > view to include the JSF javascript library manually and thus to make it
> > work:
> >
> > <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> >
> > Regards,
> > Jakob
> >
> > 2010/4/1 Matthias Leis <ma...@gmx.net>
> >
> > > Hi,
> > >
> > > I have this piece of code:
> > > <h:commandLink value="#{msg.adminPageLogFileTableDelete}"
> > > action="#{adminPage.deleteLogFile}" onclick="confirm('Are you
> sure?')"/>
> > >
> > > When I click the link, I get an JavaScript error: jsf is not defined
> > >
> > > What does this mean?
> > >
> > > I am using myfaces 2.0.0-beta-3
> > >
> > > Any help is appreciated :)
> > > --
> > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > >
>
> --
> Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
> jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser
>

Re: javascript error "jsf is not defined"

Posted by Matthias Leis <ma...@gmx.net>.
Hi Jakob,

thanks for your quick reply. I tried 
<h:outputScript name="jsf.js" library="javax.faces" target="head"/>
and I get
Tag Library supports namespace: http://java.sun.com/jsf/html, but no tag was defined for name: outputScript

I know, that outputScript is defined, but how to tell it JSF? ;) How to update my taglib?

I'm almost sorry for this question :(

Thanks!
-------- Original-Nachricht --------
> Datum: Thu, 1 Apr 2010 11:48:06 +0200
> Von: Jakob Korherr <ja...@gmail.com>
> An: MyFaces Discussion <us...@myfaces.apache.org>
> Betreff: Re: javascript error "jsf is not defined"

> Hi Matthias,
> 
> If you have some javascript in onclick we have to use the jsf.util.chain()
> function to chain your javascript with the MyFaces javascript. For that to
> work we need the JSF javascript library in the view. This include _should_
> happen automatically, but it seems that it does not.
> 
> I'll take a look at this one! For now you can include the following in
> your
> view to include the JSF javascript library manually and thus to make it
> work:
> 
> <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
> 
> Regards,
> Jakob
> 
> 2010/4/1 Matthias Leis <ma...@gmx.net>
> 
> > Hi,
> >
> > I have this piece of code:
> > <h:commandLink value="#{msg.adminPageLogFileTableDelete}"
> > action="#{adminPage.deleteLogFile}" onclick="confirm('Are you sure?')"/>
> >
> > When I click the link, I get an JavaScript error: jsf is not defined
> >
> > What does this mean?
> >
> > I am using myfaces 2.0.0-beta-3
> >
> > Any help is appreciated :)
> > --
> > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> >

-- 
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser

Re: javascript error "jsf is not defined"

Posted by Jakob Korherr <ja...@gmail.com>.
Hi Matthias,

If you have some javascript in onclick we have to use the jsf.util.chain()
function to chain your javascript with the MyFaces javascript. For that to
work we need the JSF javascript library in the view. This include _should_
happen automatically, but it seems that it does not.

I'll take a look at this one! For now you can include the following in your
view to include the JSF javascript library manually and thus to make it
work:

<h:outputScript name="jsf.js" library="javax.faces" target="head"/>

Regards,
Jakob

2010/4/1 Matthias Leis <ma...@gmx.net>

> Hi,
>
> I have this piece of code:
> <h:commandLink value="#{msg.adminPageLogFileTableDelete}"
> action="#{adminPage.deleteLogFile}" onclick="confirm('Are you sure?')"/>
>
> When I click the link, I get an JavaScript error: jsf is not defined
>
> What does this mean?
>
> I am using myfaces 2.0.0-beta-3
>
> Any help is appreciated :)
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>