Have you added the JSF implementation's JARs to your classpath?

Matt


lupus wrote:
> 
> Hi all,
> 
> I cannot get Struts 2 JSF plugin working, the plugin documentation
> (http://struts.apache.org/2.x/docs/jsf-plugin.html) is not clear for me to
> follow and the jsf show-case mixed all the things together..., I do not
> know what configurations I need to get the JSF plugin working. I tried and
> failed. what I want to achieve is "when you input your name in jsf page,
> there comes a greeting page".
> 
> In the follow is what I have tried: 
> 
> 1. I add JavaServer Faces Servlet Configuration in web.xml as what the
> show-case does, but I get the error message: The requested resource
> (Servlet faces is not available) is not available.
> 
>        <!-- JavaServer Faces Servlet Configuration, not used directly -->
>       <servlet>
>       <servlet-name>faces</servlet-name>
>           <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>       <load-on-startup>1</load-on-startup>
>       </servlet>
> 
>       <!-- JavaServer Faces Servlet Mapping, not called directly -->
>       <servlet-mapping>
>         <servlet-name>faces</servlet-name>
>            <url-pattern>*.action</url-pattern>
>         </servlet-mapping> 
> 
> 2. I add struts-jsf.xml into struts.xml
> 
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd";>
>  
> <struts>
>   <package name="jsf" extends="jsf-default" namespace="/jsf">
> 
>       <result-types>
>           <result-type name="jsf"
> class="org.apache.struts2.jsf.FacesResult" />
>       </result-types>
> 
>     <interceptors>
>       <interceptor-stack name="jsfFullStack">
>         <interceptor-ref name="params" />
>         <interceptor-ref name="basicStack"/>
>         <interceptor-ref name="jsfStack"/>
>       </interceptor-stack>
>     </interceptors>
> 
>     <default-interceptor-ref name="jsfFullStack"/>
> 
>   </package>
>   
>   <package name="web.jsf.personBean" extends="jsf"
> namespace="/web/jsf/PersonBean">
>   
>     <action name="getPersonName" class="web.jsf.PersonBean"
> method="getPersonName">
>       <result name="success" type="jsf" />
>     </action>
>       <action name="setPersonName" class="web.jsf.PersonBean"
> method="setPersonName">
>       <result name="success" type="jsf" />
>     </action>
>   </package>
> 
> </struts>
> 
> 3. My java class PersonBean.java:
> package web.jsf;
> 
> public class PersonBean {
> 
>    String personName;
>       
>    /**
>    * @return Person Name
>    */
>    public String getPersonName() {
>       return personName;
>    }
> 
>    /**
>    * @param Person Name
>    */
>    public void setPersonName(String name) {
>       personName = name;
>    }
> }
> 
> 4. Here is my jsp inputname.jsp
> 
>  <f:view>
>      <h1>
>       <h:outputText value="input name header"/>
>      </h1>
>      <h:form id="helloForm">
>       <h:outputText value="Prompt"/>
>       <h:inputText value="#{action.personBean.personName}" />
>       <h:commandButton action="#{action.personBean}" value="Greeting word"
> />
>       </h:form>
>    </f:view>
> 
> I think in my jsp action mapping may not be correct, but I don't know how
> to fix it.
> 
> Did I miss some configurations ? Please help me out.
> 
> Thank you very much!!!:-)
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-use-struts-2-JSF-plugin--Help-pls%21%21%21-tf4178602.html#a11883175
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to