2014-01-30 8 views
1

두 개의 숫자를 더하고 출력을 표시하려고하는데 렌더링 문제가 있습니다.명령 단추가 스프링 웹 플로우 프로젝트의 잘못된 경로 이름에 연결됩니다.

나는 이것을 ajax 로그에서 얻는다.

info [12:44:10.893]: Element error 
<error> 
    <error-name> 
    class com.sun.faces.context.FacesFileNotFoundException 
    </error-name> 
    <error-message> 
    <![CDATA[/WEB-INF/WEB-INF/intro.xhtml Not Found in ExternalContext as a Resource]]> 
    </error-message> 
</error> 

나는 그것이 경로 이름에서 두 WEB-INF 폴더를 받고 위치를 볼 수 없습니다 (가독성을 위해 밖으로 간격).

이 질문의 두 번째 부분은 어느 곳에서 calculator.sum이 호출되어야하는지 잘 모르겠다는 것입니다. 이것은 결과에 영향을 미치거나 별도의 질문이 필요할 수 있습니다. # {calculator.sum}은 버튼을 클릭 할 때 호출되는 출력입니다.

이것은 내가 편집하는 형식입니다.

<rich:panel id="UserManagePanel" header="Welcome to test"> 

<a href="main">Enter The WebFlow</a> 
    <br/> 
    <br/> 
    <br/> 
    <h:inputText id="additive1" value="#{calculator.a}"/> 
    <br/> 
    <h:inputText id="additive2" value="#{calculator.b}"/> 
    <br/> 
    <a4j:commandButton type="button" id="btn_add" action="#{calculator.sum}" value="Add" reRender="out" execute="@form"/> 
    <br/> 

    <a4j:outputPanel id="out"> 
    <h:outputText value="#{calculator.sum}" rendered="true"/> 
    </a4j:outputPanel> 
    <br/> 

    <a4j:log/> 

    </rich:panel> 
    </h:form> 

지원 문서 :

메인 flow.xml

<?xml version="1.0" encoding="UTF-8"?> 
<flow xmlns="http://www.springframework.org/schema/webflow" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/webflow 
     http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd"> 

    <view-state id="Page2"> 
     <transition on="gotoPage3" to="Page3"/> 
     <!-- <transition on="printDets"> 
      <evaluate expression="userBean.printDetails()" /> 
     </transition> --> 
    </view-state> 

    <view-state id="Page3"> 
     <transition on="gotoSubFlow" to="Page3subflow"/> 
     <transition on="gotoPage5" to="Page5"/> 
    </view-state> 

    <view-state id="Page5"> 
    </view-state> 

    <subflow-state id="Page3subflow" subflow="subflow1"> 
    </subflow-state> 

    <end-state id="finish" /> 

</flow> 

web.xml을

<?xml version="1.0" encoding="ASCII"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 

<!-- The master configuration file for this Spring web application --> 
<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value> 
     /WEB-INF/config/web-application-config.xml 
    </param-value> 
</context-param> 

<!-- Declare Spring Security Facelets tag library 
<context-param> 
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name> 
    <param-value>/WEB-INF/springsecurity.taglib.xml</param-value> 
</context-param> --> 

<!-- Enforce UTF-8 Character Encoding --> 
<filter> 
    <filter-name>charEncodingFilter</filter-name> 
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
    <init-param> 
     <param-name>encoding</param-name> 
     <param-value>UTF-8</param-value> 
    </init-param> 
    <init-param> 
     <param-name>forceEncoding</param-name> 
     <param-value>true</param-value> 
    </init-param> 
</filter> 

<filter-mapping> 
    <filter-name>charEncodingFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

<!-- Enables Spring Security --> 
<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 

<filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

<!-- 
<context-param> 
    <param-name>org.richfaces.skin</param-name> 
    <param-value>joshCustom</param-value> 
</context-param> 
--> 
<context-param> 
    <param-name>org.richfaces.enableControlSkinning</param-name> 
    <param-value>true</param-value> 
</context-param> 

<context-param> 
    <param-name>facelets.SKIP_COMMENTS</param-name> 
    <param-value>true</param-value> 
</context-param> 

<!-- Use JSF view templates saved as *.xhtml, for use with Facelets --> 
<context-param> 
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
    <param-value>.xhtml</param-value> 
</context-param> 

<!-- Enables special Facelets debug output during development --> 
<context-param> 
    <param-name>javax.faces.PROJECT_STAGE</param-name> 
    <param-value>Development</param-value> 
</context-param> 

<!-- Causes Facelets to refresh templates during development --> 
<context-param> 
    <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> 
    <param-value>1</param-value> 
</context-param> 

<!-- 
    Uncomment this to disable partial state saving when using Apache MyFaces 2 !! 
<context-param> 
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> 
    <param-value>false</param-value> 
</context-param> 
--> 

<!-- Loads the Spring web application context --> 
<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 

<!-- The front controller of this Spring Web application, responsible for handling all application requests --> 
<servlet> 
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <init-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value></param-value> 
    </init-param> 
    <load-on-startup>2</load-on-startup> 
</servlet> 

<!-- Map all /spring requests to the Dispatcher Servlet for handling --> 
<servlet-mapping> 
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
    <url-pattern>/spring/*</url-pattern> 
</servlet-mapping> 

<!-- Just here so the JSF implementation can initialize, *not* used at runtime --> 
<servlet> 
    <servlet-name>Faces Servlet</servlet-name> 
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

<!-- Just here so the JSF implementation can initialize --> 
<servlet-mapping> 
    <servlet-name>Faces Servlet</servlet-name> 
    <url-pattern>*.faces</url-pattern> 
</servlet-mapping> 

<!-- Added for JAX-WS compatibility --> 
<servlet> 
    <servlet-name>JAX-WS Servlet</servlet-name> 
    <servlet-class>demo.SimpleServiceImpl</servlet-class> 
</servlet> 

<servlet-mapping> 
<servlet-name>JAX-WS Servlet</servlet-name> 
    <url-pattern>/SimpleService</url-pattern> 
</servlet-mapping> 



    <!-- The welcome file --> 
    <welcome-file-list> 
     <welcome-file>index.html</welcome-file> 
    </welcome-file-list> 

</web-app><?xml version="1.0" encoding="ASCII"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 

    <!-- The master configuration file for this Spring web application --> 
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value> 
      /WEB-INF/config/web-application-config.xml 
     </param-value> 
    </context-param> 

    <!-- Declare Spring Security Facelets tag library 
    <context-param> 
     <param-name>javax.faces.FACELETS_LIBRARIES</param-name> 
     <param-value>/WEB-INF/springsecurity.taglib.xml</param-value> 
    </context-param> --> 

    <!-- Enforce UTF-8 Character Encoding --> 
    <filter> 
     <filter-name>charEncodingFilter</filter-name> 
     <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
     <init-param> 
      <param-name>encoding</param-name> 
      <param-value>UTF-8</param-value> 
     </init-param> 
     <init-param> 
      <param-name>forceEncoding</param-name> 
      <param-value>true</param-value> 
     </init-param> 
    </filter> 

    <filter-mapping> 
     <filter-name>charEncodingFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <!-- Enables Spring Security --> 
    <filter> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
    </filter> 

    <filter-mapping> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <!-- 
    <context-param> 
     <param-name>org.richfaces.skin</param-name> 
     <param-value>joshCustom</param-value> 
    </context-param> 
    --> 
    <context-param> 
     <param-name>org.richfaces.enableControlSkinning</param-name> 
     <param-value>true</param-value> 
    </context-param> 

    <context-param> 
     <param-name>facelets.SKIP_COMMENTS</param-name> 
     <param-value>true</param-value> 
    </context-param> 

    <!-- Use JSF view templates saved as *.xhtml, for use with Facelets --> 
    <context-param> 
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
     <param-value>.xhtml</param-value> 
    </context-param> 

    <!-- Enables special Facelets debug output during development --> 
    <context-param> 
     <param-name>javax.faces.PROJECT_STAGE</param-name> 
     <param-value>Development</param-value> 
    </context-param> 

    <!-- Causes Facelets to refresh templates during development --> 
    <context-param> 
     <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> 
     <param-value>1</param-value> 
    </context-param> 

    <!-- 
     Uncomment this to disable partial state saving when using Apache MyFaces 2 !! 
    <context-param> 
     <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> 
     <param-value>false</param-value> 
    </context-param> 
    --> 

    <!-- Loads the Spring web application context --> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <!-- The front controller of this Spring Web application, responsible for handling all application requests --> 
    <servlet> 
     <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <param-value></param-value> 
     </init-param> 
     <load-on-startup>2</load-on-startup> 
    </servlet> 

    <!-- Map all /spring requests to the Dispatcher Servlet for handling --> 
    <servlet-mapping> 
     <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> 
     <url-pattern>/spring/*</url-pattern> 
    </servlet-mapping> 

    <!-- Just here so the JSF implementation can initialize, *not* used at runtime --> 
    <servlet> 
     <servlet-name>Faces Servlet</servlet-name> 
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <!-- Just here so the JSF implementation can initialize --> 
    <servlet-mapping> 
     <servlet-name>Faces Servlet</servlet-name> 
     <url-pattern>*.faces</url-pattern> 
    </servlet-mapping> 

    <!-- Added for JAX-WS compatibility --> 
    <servlet> 
     <servlet-name>JAX-WS Servlet</servlet-name> 
     <servlet-class>demo.SimpleServiceImpl</servlet-class> 
    </servlet> 

    <servlet-mapping> 
    <servlet-name>JAX-WS Servlet</servlet-name> 
     <url-pattern>/SimpleService</url-pattern> 
    </servlet-mapping> 

    <!-- The welcome file --> 
    <welcome-file-list> 
     <welcome-file>index.html</welcome-file> 
    </welcome-file-list> 

</web-app> 

자바 클래스 Calculator.java

package demo; 

import javax.faces.bean.*; 

import org.springframework.stereotype.Component; 

@ManagedBean 
@Component 
@ViewScoped 
public class Calculator implements java.io.Serializable{ 

     private static final long serialVersionUID = -3832235132261771583L; 

     private int _a; 
     private int _b; 

     public int getA() { return _a; } 
     public void setA(int a) { _a = a; } 

     public int getB() { return _b; } 
     public void setB(int b) { _b = b; } 

     public int getSum() 
     { 
     return _a + _b; 
     } 

} 
내가 사용 6,

라이브러리 : 사용 Richfaces 4.3.4 봄 보안 3.1.3 JSTL 1.2.1 봄 3.2.0.RELEASE 만 수를 반환 (그리고하지 않는 calculator.sum 때문에

+0

당신은 자신의 질문에 대답해야합니다. 당신이 해답을 찾았다 고해도 나는 대답하지 않으려 고합니다. –

답변

0

이 기능을 사용하려면 몇 가지 일이 발생해야했습니다.

1) WEB-INF /는 flowlistener 아래의 webmvc-config.xml에서 가져옵니다.
2) 적어도 디버깅 할 때 사용해야했습니다.
3) 양식과 태그가 있어야합니다. 코드를 얻을로

http://localhost:8080/CLPWeb/spring/grantSearchFlow?test 

    rather than 

http://localhost:8080/CLPWeb/spring/WEB-INF/templates/views/test.xhtml 

중고의 URL의 그것을 확인하기 webflow
4) URL입니다 사용해야합니다.

0

배경에있는 모든 것) 버튼을 클릭 할 때 아무런 요령도 없습니다.

무엇이 오류의 원인인지 모르겠지만 WEB-INF은 설정 파일을위한 것입니다. 거기에 (x) html 페이지가 있다면 그들을 밖으로 이동하십시오.