我正在使用PrimeFaces 4.0 / Mojarra 2.2库的eclipse kepler,JSF 2.2。
实际上有两个问题:
无论我做什么,我仍然会收到此服务器消息。
((javax.el.PropertyNotFoundException:/Order.xhtml @ 28,76 value ="#{kk.refugee.id}":目标无法到达,'难民&# 39;返回null)) 如果我删除隐藏的输入文本脉冲,则会弹出消息“材料”。 selectOneMenu用于
我没有机会参加考试:((这个javascript代码是否正确,将一个组件的值复制到另一个组件。)
这些是我的xhtml文件和java calsses。 thx in advanced。
package khldqr.beans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@SessionScoped
@ManagedBean
public class kk {
private RefugeeMan refugee;
public void AidsSpecialInsert(){
System.out.println(refugee.getId());
System.out.println(refugee.getMaterial());
System.out.println(refugee.getId2());
}
public kk() {
// TODO Auto-generated constructor stub
}
public RefugeeMan getRefugee() {
return refugee;
}
public void setRefugee(RefugeeMan refugee) {
this.refugee = refugee;
}
}
**
**
package khldqr.beans;
import java.io.Serializable;
public class RefugeeMan implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int id ;
private String material;
private Integer id2;
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the material
*/
public String getMaterial() {
return material;
}
/**
* @param material the material to set
*/
public void setMaterial(String material) {
this.material = material;
}
/**
* @return the amount
*/
public RefugeeMan(){}
/**
* @return the id2
*/
public Integer getId2() {
return id2;
}
/**
* @param id2 the id2 to set
*/
public void setId2(Integer id2) {
this.id2 = id2;
}
}
**
**
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Facelet Title</title>
<script type="text/javascript">
function setHiddenValue() {
document.getElementById('hidKBCardNo').value = document
.getElementById('KBCardNo').value;
return true;
}
</script>
</h:head>
<h:body>
<h:form id="frmAids" prependId="false">
<p:panel id="display" header="Sale Item" style="width: 450px;">
<p:panelGrid id="pgrid" columns="2">
<h:outputText id="outxtID" value="ID" />
<p:keyboard id="KBCardNo" value="#{kk.refugee.id}" keypadOnly="true" />
<h:outputText for="hidKBCardNo" />
<h:inputHidden id="hidKBCardNo" value="#{kk.refugee.id2}" />
<h:outputText value="material" />
<p:selectOneMenu value="#{kk.refugee.material}">
<f:selectItem itemLabel="choose one:" itemValue="" />
<f:selectItem itemLabel="Option1" itemValue="Option1" />
<f:selectItem itemLabel="Option2" itemValue="Option2" />
<f:selectItem itemLabel="Option3" itemValue="Option3" />
</p:selectOneMenu>
<p:commandButton value="Submit" onclick="setHiddenValue();"
action="#{kk.AidsSpecialInsert}" />
</p:panelGrid>
</p:panel>
</h:form>
</h:body>
</html>