2010-11-18 8 views
0

나는이 간단한 시나리오가 작동하지 않습니다. 나는 얼음 표면을 사용하며 일부 inputText와 제출 버튼이있는 간단한 페이지가 있습니다.이 버튼은 다른 페이지로 리디렉션됩니다. 이 inputTexts의 값을 표시합니다 ... 내 질문에 어떻게 이러한 inputTexts의 값을 요청에서 얻을 수 있고 다른 페이지에 표시 할 수 있습니까? 일이 일을려고 정말 시간을 많이 보냈다 않았다ICEfaces : 한 페이지에서 다른 페이지로 매개 변수를 전달하는 방법

FacesContext.getCurrentInstance().getExternalContext().getRequestMap(); 

: 내가 다른 페이지 backbean에서 다음과 같은 API를 사용하는 경우

, 나는 inputTexts을 보유하고있는 페이지의 이름을 얻을 어떤 도움이 이해할 수 있도록 .. THX

내 페이지 코드는 다음과 같습니다

<ice:form id="form1"> 
<table border="0"> 
    <tbody> 
     <tr> 
      <td><ice:outputText value="Name"></ice:outputText><br></br></td> 
      <td><ice:inputText id="name" value="#{newContest.name}"></ice:inputText></td> 
     </tr> 
     <tr> 
      <td><ice:outputText value="End Date"></ice:outputText></td> 
      <td><ice:inputText id="endDate" value="#{newContest.endDate}"></ice:inputText></td> 
     </tr> 
     <tr> 
      <td><ice:outputText value="private? (only you can see the entries)"></ice:outputText></td> 
      <td><ice:inputText id="private" value="#{newContest.isPublic}"></ice:inputText></td> 
     </tr> 
     <tr> 
      <td><ice:outputText value="Price"></ice:outputText></td> 
      <td><ice:inputText id="price" value="#{newContest.price}"></ice:inputText></td> 
     </tr> 
     <tr> 
      <td><ice:outputText value="Description"></ice:outputText></td> 
      <td><ice:inputTextarea id="description" value="#{newContest.description}"></ice:inputTextarea></td> 
     </tr> 
     <tr> 
      <td><br></br><ice:commandButton value="proceed to payment" style="color:blue" action="#{newContest.createContest}"></ice:commandButton></td> 
     </tr> 
    </tbody> 
</table> 

답변

1

다음과 같이 faces-config.xml에서 다른 bean을 관리 속성으로 현재 bean으로 바인드 할 수 있습니다.

<managed-bean> 
     <managed-bean-name>newContest</managed-bean-name> 
     <managed-bean-class>com.newContest</managed-bean-class> 
     <managed-bean-scope>request</managed-bean-scope> 

     <managed-property> 
     <property-name>anotherBackingBean</property-name> 
      <property-class>com.AnotherBackingBean</property-class> 
      <value>#{anotherBackingBean}</value> 
    </managed-property>  
    </managed-bean> 


<navigation-rule>  
      <navigation-case> 
      <from-outcome>view-anotherBackingBean</from-outcome> 
      <to-view-id>/jsp/another-page.jspx</to-view-id> 
     </navigation-case> 
    </navigation-rule> 

콩 내용

Class NewContest { 

public AnotherBackingBean anotherBackingBean; 

//-- set/get & other methods 

public String redirectToAnotherBackingBean(){ 

     anotherBackingBean.setSomeObject(object); 

     //-- set custom fields 

     return "view-anotherBackingBean"; 
    } 

} 

그럼 당신은 현재 빈에서 설정 한 다른 콩에 필드에 요청하실 수 있습니다.

+0

나를 위해 아주 잘 작동했습니다! 고마워요! 뒤로 버튼이 작동하도록 탐색 규칙에 태그를 추가하면 값이 다음 페이지에 표시되지 않습니다. 저게 뭐야?! –

관련 문제