索引.xhtml
<?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:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<head>
<title>Title</title>
<!-- CSS -->
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/main.css" />
<h:outputStylesheet>
</h:outputStylesheet>
</head>
<body>
<h:form>
<h:button value="Yeni Kayıt Oluştur">
<f:param name="kayitOlustur" value="20" />
</h:button>
<h:button value="Mevcut Kayıtları Listele">
<f:param name="kayitListele" value="20" />
</h:button>
<h:button value="Mevcut Kayıtları Düzenle">
<f:param name="kayitDuzenle" value="20" />
</h:button>
</h:form>
<div style="min-height:20px;"></div>
<!-- FORM -->
<h:form>
<h:panelGrid columns="2">
<h:outputText value="Ad & Soyad Giriniz:"></h:outputText>
<h:inputText value="#{Test.adSoyad}"></h:inputText>
<h:outputText value="Cinsiyet Seçiniz:"></h:outputText>
<h:selectManyCheckbox value="#{Test.cinsiyet}">
<f:selectItem itemLabel="Kadın" itemValue="Kadın"></f:selectItem>
<f:selectItem itemLabel="Erkek" itemValue="Erkek"></f:selectItem>
</h:selectManyCheckbox>
<h:outputText value="Adresinizi Giriniz:"></h:outputText>
<h:inputTextarea value="#{Test.adres}"></h:inputTextarea>
<h:outputText value="İl Seçimi Yapınız:"></h:outputText>
<h:selectOneMenu value="#OzgurSoftwareClass.il">
<f:selectItem itemLabel="İstanbul" itemValue="İstanbul"></f:selectItem>
<f:selectItem itemLabel="İzmir" itemValue="İzmir"></f:selectItem>
<f:selectItem itemLabel="Ankara" itemValue="Ankara"></f:selectItem>
<f:selectItem itemLabel="Diğer" itemValue="Diğer"></f:selectItem>
</h:selectOneMenu>
<h:outputText value="Parola Belirleyiniz:"></h:outputText>
<h:inputSecret value="{#Test.parola}"></h:inputSecret>
<h:outputText value="Kayıt Şartları Kabul Ediyorum"></h:outputText>
<h:selectBooleanCheckbox value="#{Test.sartlar}" />
<h:outputText value="Kayıt Oluştur"></h:outputText>
<h:commandButton value="Gönder" update="display" />
</h:panelGrid>
<h:panelGrid columns="1">
<h4>Kayıt Edilen Üyenin Bigileri</h4>
<!--<h:outputText value="{#Test.bilgi}" />
<h:outputText value="{#Test.adSoyad}" />
<h:outputText value="{#Test.cinsiyet}" />
<h:outputText value="{#Test.il}" />
<h:outputText value="{#Test.parola}" />-->
<h:outputText id="bilgi" value="#{Test.bilgi}" />
<h:outputText id="adSoyad" value="#{Test.adSoyad}" />
<h:outputText id="cinsiyet" value="#{Test.cinsiyet}" />
<h:outputText id="il" value="#{Test.il}" />
<h:outputText id="parola" value="#{Test.parola}" />
</h:panelGrid>
</h:form>
</body>
</html>
测试.java
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import java.util.ArrayList;
import java.util.List;
@ManagedBean(name = "Test")
@RequestScoped
public class Test{
private String adSoyad;
private List<String> cinsiyet=new ArrayList<String>();
private String adres;
private String il;
private String parola;
private boolean sartlar;
private String bilgi;
public String getAdSoyad(){
return adSoyad;
}
public void setAdSoyad(String adSoyad){
this.adSoyad = adSoyad;
}
public List<String> getCinsiyet(){
return cinsiyet;
}
public void setCinsiyet(List<String> cinsiyet){
this.cinsiyet = cinsiyet;
}
public String getAdres(){
return adres;
}
public void setAdres(String adres){
this.adres = adres;
}
public String getIl(){
return il;
}
public void setIl(String il){
this.il = il;
}
public String getSartlar(){
if (!sartlar)
{
bilgi="Şartları Kabul Ediniz!";
}
else
{
bilgi="Şartları Kabul Ettiniz!";
}
return bilgi;
}
}
错误:
javax.servlet.ServletException: /index.xhtml @41,61 value="#{Test.adSoyad}": 目标不可达,标识符“测试”解析为空
javax.el.PropertyNotFoundException: /index.xhtml @41,61 value="#{Test.adSoyad}": 目标无法到达,标识符“测试”解析为空
javax.el.PropertyNotFoundException:目标不可达,标识符“测试”解析为空