You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jason Wyatt <jw...@itree.com.au> on 2007/06/25 08:29:18 UTC

[S2] How to integrate JSF with struts 2?

I'm confused as to how to integrate a third-party JSF component with our
Struts 2 app.

I've been able to get a the third-party example JSF page working with using
one web.xml file, and our Struts 2 app works with another ordinary web.xml
file, but I can't seem to get both working together using one web.xml file.

The example at http://struts.apache.org/2.x/docs/javaserver-faces.html shows
one way of integrating JSF with Struts 2 - by adding  <interceptor-ref
name="jsfStack" /> to the action definition. 

However, I don't really understand the example... How does the action know
to go to the employee page on success? It seems to be missing something. The
example code:

<action name="employee"
class="org.apache.struts.action2.showcase.jsf.EmployeeAction">
    <interceptor-ref name="basicStack"/>
    <interceptor-ref name="jsfStack"/>
    <result name="success" type="jsf" />
    <result name="index" type="redirect-action">index</result>
</action>


The "showcase" JSF example seems to use another way - by setting up a
javax.faces.webapp.FacesServlet to process all *.action requests. 

This seems quite different to the documented example above, and
counterintuitive... If Faces is processing the actions, then how does the
struts framework get called?


Thanks for any help, regards

Jason


-----
Falun Dafa  Truth - Compassion - Forbearance

A mind & body practice under persecution in China

http://www.faluninfo.net












---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [S2] How to integrate JSF with struts 2?

Posted by Jason Wyatt <jw...@itree.com.au>.
Thanks Don, I finally got JSF working with struts 2.

Seems like the docs at
http://struts.apache.org/2.x/docs/javaserver-faces.html could really use an
example of how to set up the jsf plugin. 

I didn't realise the JSF plugin isn't normally "plugged in" until I saw the
struts-plugin.xml inside the struts2-jsf-plugin-2.0.6.jar and the
struts-jsf.xml file under the showcase\web\WEB-INF\classes directory.

Maybe I missed some other resource on the web?

Regards
Jason
 

-----Original Message-----
From: Don Brown [mailto:donald.brown@gmail.com] 
Sent: Monday, 25 June 2007 6:54 PM
To: Struts Users Mailing List
Subject: Re: [S2] How to integrate JSF with struts 2?

How the JSF integration works is we decompose the JSF Lifecycle object into
its phases and store each in a Struts 2 Interceptor.  Therefore, the request
enters the Struts 2 FilterDispatcher like normal, then if the action mapping
includes the JSF interceptors (like it does in your example by including the
"jsfStack"), the request will go through the JSF phases.  The page
displayed, employee.jsp, is determined using normal JSF means (taking the
action name and appending a ".jsp").
Even that might be configurable, though I couldn't say for sure.

Don

On 6/25/07, Jason Wyatt <jw...@itree.com.au> wrote:
> I'm confused as to how to integrate a third-party JSF component with 
> our Struts 2 app.
>
> I've been able to get a the third-party example JSF page working with 
> using one web.xml file, and our Struts 2 app works with another 
> ordinary web.xml file, but I can't seem to get both working together using
one web.xml file.
>
> The example at http://struts.apache.org/2.x/docs/javaserver-faces.html 
> shows one way of integrating JSF with Struts 2 - by adding  
> <interceptor-ref name="jsfStack" /> to the action definition.
>
> However, I don't really understand the example... How does the action 
> know to go to the employee page on success? It seems to be missing 
> something. The example code:
>
> <action name="employee"
> class="org.apache.struts.action2.showcase.jsf.EmployeeAction">
>     <interceptor-ref name="basicStack"/>
>     <interceptor-ref name="jsfStack"/>
>     <result name="success" type="jsf" />
>     <result name="index" type="redirect-action">index</result>
> </action>
>
>
> The "showcase" JSF example seems to use another way - by setting up a 
> javax.faces.webapp.FacesServlet to process all *.action requests.
>
> This seems quite different to the documented example above, and 
> counterintuitive... If Faces is processing the actions, then how does 
> the struts framework get called?
>
>
> Thanks for any help, regards
>
> Jason
>
>
> -----
> Falun Dafa  Truth - Compassion - Forbearance
>
> A mind & body practice under persecution in China
>
> http://www.faluninfo.net
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] How to integrate JSF with struts 2?

Posted by Don Brown <do...@gmail.com>.
How the JSF integration works is we decompose the JSF Lifecycle object
into its phases and store each in a Struts 2 Interceptor.  Therefore,
the request enters the Struts 2 FilterDispatcher like normal, then if
the action mapping includes the JSF interceptors (like it does in your
example by including the "jsfStack"), the request will go through the
JSF phases.  The page displayed, employee.jsp, is determined using
normal JSF means (taking the action name and appending a ".jsp").
Even that might be configurable, though I couldn't say for sure.

Don

On 6/25/07, Jason Wyatt <jw...@itree.com.au> wrote:
> I'm confused as to how to integrate a third-party JSF component with our
> Struts 2 app.
>
> I've been able to get a the third-party example JSF page working with using
> one web.xml file, and our Struts 2 app works with another ordinary web.xml
> file, but I can't seem to get both working together using one web.xml file.
>
> The example at http://struts.apache.org/2.x/docs/javaserver-faces.html shows
> one way of integrating JSF with Struts 2 - by adding  <interceptor-ref
> name="jsfStack" /> to the action definition.
>
> However, I don't really understand the example... How does the action know
> to go to the employee page on success? It seems to be missing something. The
> example code:
>
> <action name="employee"
> class="org.apache.struts.action2.showcase.jsf.EmployeeAction">
>     <interceptor-ref name="basicStack"/>
>     <interceptor-ref name="jsfStack"/>
>     <result name="success" type="jsf" />
>     <result name="index" type="redirect-action">index</result>
> </action>
>
>
> The "showcase" JSF example seems to use another way - by setting up a
> javax.faces.webapp.FacesServlet to process all *.action requests.
>
> This seems quite different to the documented example above, and
> counterintuitive... If Faces is processing the actions, then how does the
> struts framework get called?
>
>
> Thanks for any help, regards
>
> Jason
>
>
> -----
> Falun Dafa  Truth - Compassion - Forbearance
>
> A mind & body practice under persecution in China
>
> http://www.faluninfo.net
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org