What Im missing, this is what I do:
1- In the web.xml:
<context-param>
<param-name>onload-config</param-name>
<param-value>/WEB-INF/onload-config.xml</param-value>
</context-param>
2- In the faces-config.xml
<lifecycle>
...
<phase-listener>net.sf.jsfcomp.ext.onload.OnLoadPhaseListener
</phase-listener>
</lifecycle>
...
<managed-bean>
<description>Seguridad</description>
<managed-bean-name>SeguridadBean</managed-bean-name>
<managed-bean-class>persona.SeguridadBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
...
<navigation-rule>
<from-view-id>/JSP/Seguridad/Login.jsp</from-view-id>
<navigation-case>...
3- In the onload-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<onload-config xmlns="urn:onload-config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:onload-config onload-config.xsd">
<navigation-rule>
<view-id>/JSP/Seguridad/Login.jsp</view-id>
<action>#{SeguridadBean.limpiarFormulario}</action>
</navigation-rule>
</onload-config>
4- I add the onload-config.xsd as is
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:onload-config"
xmlns="urn:onload-config"
elementFormDefault="qualified" version="1.0">
<xs:element name="onload-config" type="Config"/>
<xs:complexType name="Config">
<xs:annotation>
<xs:documentation>
Root element. Contains the
configuration for the OnLoadPhaseListener
</xs:documentation>
</xs:annotation>
<xs:sequence maxOccurs="unbounded">
<xs:element name="navigation-rule"
type="Rule"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Rule">
<xs:annotation>
<xs:documentation>
Defines the navigation rule
for a JSF view-id or view-id pattern
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="view-id"
type="ViewId"/>
<xs:element name="action"
type="Action"/>
<xs:element name="success-result"
type="SuccessResult" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="ViewId">
<xs:annotation>
<xs:documentation>
The view ID to match. This
can be a full view-id or a path
ending with an asterisk.
Examples: /myDir/myFile.xhtml, /myDir/my*, *
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="Action">
<xs:annotation>
<xs:documentation>
The EL syntax action name to
invoke. This is the same syntax as
when specifying an action in
the JSF page.
Example: #{
myBean.myActionMethod}
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="SuccessResult">
<xs:annotation>
<xs:documentation>
If the result of an action
is null or equal to the success result,
nothing is done. If the
result is not equal to the success result
the result is used to
navigate to a new view based on the
faces configuration file.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:schema>
5- In SeguridadBean I add the method limpiarFormulario
public void limpiarFormulario(){
...
}
6- I add the jar jsfExt.0.8.1 to web-inf
The only differences that I saw was that I used:
myfaces-api-1.1.5.jar
myfaces-impl-1.1.5.jar
commons-logging-1.1.jar
I need to use my faces 1.1.5 and commons-logging-1.1, that is the problem?
That´s why nothing happens?
What I'm missing? I run the Login.jsp but the method limpiarFormulario was
not called
On Jan 8, 2008 3:24 PM, daniel ccss <[EMAIL PROTECTED]> wrote:
> Ok Andrew I will try it and tell you, thanks
>
>
> On Jan 7, 2008 3:47 PM, Andrew Robinson <[EMAIL PROTECTED]>
> wrote:
>
> > Runs fine on JBoss if you aren't using Seam. If you are using seam use
> > the "action" attribute in the pages.xml. It is basically the same thing.
> > My on-load is nice for ppl. who want the functionality without adding a full
> > framework
> >
> >
> > On Jan 7, 2008 2:37 PM, daniel ccss <[EMAIL PROTECTED]> wrote:
> >
> > > Thanks Andrew, but i stop reading when saw this:
> > > "
> > > Note: If you are using JBoss Seam you cannot use it due to Seam
> > > configuration conflicts.
> > > "
> > >
> > > Actually our project runs in OAS but we need for it to be posible to
> > > run in JBoss also.
> > >
> > > Any other solution?
> > >
> > > On Jan 7, 2008 3:33 PM, Andrew Robinson <
> > > [EMAIL PROTECTED]> wrote:
> > >
> > > > See my response. The simplest component is the jsf-comp one that I
> > > > wrote:
> > > >
> > > > http://jsf-comp.sourceforge.net/components/onload/index.html
> > > >
> > > >
> > > > On Jan 7, 2008 2:26 PM, daniel ccss <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > Thanks for the answers, I used a phaselistener but is for all the
> > > > > application, like the one in the example of the login:
> > > > >
> > > > > <phase-listener>com.loffler.copycenter.controller.LoggedInCheck
> > > > > </phase-listener>
> > > > > but this type of listener is call for every Bean and my case is
> > > > > different.
> > > > >
> > > > > Let me explain better my case, I have an App1 and App2, they are
> > > > > in different servers, App1 have a link to call the App2, but I need
> > > > > do some
> > > > > things before show the index of the App1, actually the link calls
> > > > > directly
> > > > > the index.jsp of the App1, In this case I only need the listener
> > > > > for do things when the App1 calls App2, something like in the onload
> > > > > of the
> > > > > app2. Can I use a listener when a specific JSP is show? Can I call
> > > > > directly
> > > > > the backing bean?
> > > > >
> > > > > thanks
> > > > >
> > > > >
> > > > >
> > > > > On Jan 7, 2008 2:53 PM, John Carlson <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > > Can you do it in Spring?
> > > > > >
> > > > > > John
> > > > > >
> > > > > >
> > > > > > At 12:24 PM 1/7/2008, you wrote:
> > > > > >
> > > > > > Hi all,
> > > > > >
> > > > > > In struts:
> > > > > > I can call a JSP page like http://..../JSP/Example.jsp and I
> > > > > > also can call an action that do something and then do the forward
> > > > > > to the
> > > > > > Example.jsp like this: http:// <http:///> .../Example*.do
> > > > > > *
> > > > > > In JSF:
> > > > > > I can call a JSP page like http://...faces/JSP/Example.jsp *but
> > > > > > *there is a way to call a backing bean before show the JSP?
> > > > > >
> > > > > > I need to do something in the backing bean (set some variables,
> > > > > > etc) before showing the jsp, but I dont know if this is posible in
> > > > > > JSF.
> > > > > >
> > > > > > thanks
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>