inputText的價值得到我不能夠在我的豆沒能獲得在豆
我已經設置好的覆蓋豆在我的工作流會話bean但要獲得輸入文本值當我試圖從輸入值文本返回null
此ID是一個潘內爾和包含形式返回假
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:form id="form2" >
<div class="contract-menubar-internal-9x90 coverage-prod-mid-panel">
<div class="cvrg-row-div-dimension">
<p:panel id="cvrg_panel">
<h:outputLabel value="Type : " styleClass="cvrg-labels" />
<p:selectOneMenu value="" styleClass="cvrg-inputs">
<f:selectItem itemLabel="Select" itemValue="" />
<f:selectItem itemLabel="ELW" itemValue="1" />
<f:selectItem itemLabel="Maintenance" itemValue="2" />
<f:selectItem itemLabel="WT" itemValue="3" />
</p:selectOneMenu>
<h:outputLabel value="Damage Code : " styleClass="cvrg-labels" />
<p:inputText styleClass="cvrg-inputs">
</p:inputText>
<h:outputLabel value="Baumuster : " styleClass="cvrg-labels" />
<p:selectOneMenu value="" styleClass="cvrg-inputs">
<f:selectItem itemLabel="Select" itemValue="" />
<f:selectItem itemLabel="207" itemValue="1" />
<f:selectItem itemLabel="221" itemValue="2" />
</p:selectOneMenu>
<h:outputLabel value="Class : "
styleClass="cvrg-labels cvrg-class-srch-label" />
<p:selectOneMenu value="" styleClass="cvrg-inputs">
<f:selectItem itemLabel="Select" itemValue="" />
<f:selectItem itemLabel="S" itemValue="1" />
<f:selectItem itemLabel="C" itemValue="2" />
</p:selectOneMenu>
</p:panel>
<p:panel>
<div class="srch-cvrg-btn">
<p:commandButton value="Search" />
</div>
<div class="reset-cvrg-btn">
<p:commandButton value="Reset" id="reset_cvrg" update="cvrg_panel"
process="@this">
<p:resetInput target="cvrg_panel"></p:resetInput>
</p:commandButton>
</div>
</p:panel>
</div>
<p:commandButton value= "Save" styleClass="add-coverage-btn" action="#{coverageFlowManager.add}" ajax="false" > </p:commandButton>
<p:commandButton value="Add Coverage" styleClass="add-coverage-btn"
onclick="addCoverage()" />
<p:commandButton value="Save" styleClass="save-coverage-btn"
id="saveCoverage" action="#{productModel.saveCoverage}"
immediate="true" partialSubmit="true" />
<p:commandButton value="Cancel" styleClass="cancel-coverage-btn"
onclick="cancelCoverage()" />
<p:inputText id="type_inp1" value="#{coverageBean.type}" />
</div>
/** * * /
package com.daimler.contract.flow;
import java.util.*;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.html.HtmlInputText;
import org.springframework.security.core.context.SecurityContextHolder;
import com.daimler.contract.bean.CoverageBean;
import com.daimler.contract.bean.ProductBean;
import com.daimler.contract.entity.CoverageEntity;
import com.daimler.contract.entity.ProductEntity;
import com.daimler.contract.model.ProductModel;
import com.daimler.contract.service.CoverageService;
import com.daimler.contract.service.ProductService;
import com.mbcl.common.bean.User;
/**
* @author Jyoti
*
*/
public class CoverageFlowManager {
private CoverageService coverageService;
private ProductModel productModel;
private CoverageBean coverageBean;
HtmlInputText type;
public HtmlInputText getType() {
return type;
}
public void setType(HtmlInputText type) {
this.type = type;
}
public void setCoverageBean(CoverageBean coverageBean) {
this.coverageBean = coverageBean;
}
public static final String query = "select * from COVERAGE_MGT";
/**
* @return the coverageService
*/
public CoverageService getCoverageService() {
return coverageService;
}
/**
* @param coverageService the coverageService to set
*/
public void setCoverageService(CoverageService coverageService) {
this.coverageService = coverageService;
}
/**
* @return the productModel
*/
public ProductModel getProductModel() {
return productModel;
}
/**
* @param productModel the productModel to set
*/
public void setProductModel(ProductModel productModel) {
this.productModel = productModel;
}
public void showCMDataTable() {
String countryCode = ((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal())
.getCountryCode();
System.out.println("jyoti THROUGH DIFF");
List<CoverageEntity> cmDataTableEntity = coverageService.getCMDataTable(countryCode, query);
productModel.setCoverageEntityList(cmDataTableEntity);
//System.out.println("set in model"+pmDataModel.getPmList());
}
public String add()
{
System.out.println("Gaurav");
System.out.println(coverageBean.getType());
System.out.println(productModel.getCoverageEntityList().get(0).getId());
System.out.println(getType().getValue());
// productModel.getCoverageEntityList().add(productModel.getNewCoverage());
return null;
}
}
請發表您的託管bean代碼,並發表您的完整XHTML。另外,我不明白爲什麼你將輸入文本綁定到一個不包含inputText類型的變量。 – Makky
我試圖價值,但還是老樣子我沒有得到空 – user2986800
直到您提供完整的XHTML和管理的Bean其無法提供幫助。 – Makky