"문서"엔티티 (JSF2 및 최대 절전 모드를 사용)에 대한 기본 편집 양식이 있는데 "작성"양식은 정상적으로 작동하지만 "편집"은 작동하지 않습니다. 따라서 편집 양식은 현재 문서 값을 표시하지만 새로운 값을 보낼 때 백bean은 이전 값을 가져 오지 않고 이전 엔티티와 같이 작동합니다. 내 edit.xhtml의JSF 업데이트 뷰가 bean을 변경하지 않습니다.
부품 : 내 문서 콩의
<ui:param name="doc" value="#{document.getDocument()}" />
<h:form id="editForm">
<h:inputHidden name="ID" id="ID" value="#{doc.ID}" />
<div class="input-group">
<span class="input-group-label">Title *</span>
<h:inputText type="text" class="input-group-field" size="30" name="title" id="title" a:required="required" a:placeholder="title" value="#{doc.title}"/>
</div>
<h:message for="title"></h:message>
<div class="input-group">
<span class="input-group-label">Subtitle</span>
<h:inputText type="text" class="input-group-field" size="30" name="subtitle" id="subtitle" a:placeholder="subtitle" value="#{doc.subtitle}" />
</div>
<h:message for="subtitle"></h:message>
<div class="button-group">
<h:button outcome="/main?faces-redirect=true" type="button" value="Cancel"></h:button>
<h:commandButton action="${doc.save}" value="Save">
<f:ajax render="@form" execute=":editForm" event="keyup"/>
</h:commandButton>
</div>
</h:form>
부품 : 나는 문서 제목을 편집하는 경우
@ManagedBean
@Entity
@ViewScoped
public class document implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "ID")
private int ID;
@NotNull
private String title;
private String subtitle;
//Getters Setters....
@Transient
public document getDocument() {
documentDAO = new DocumentDAO();
Optional<document> doc = documentDAO.read(this.ID);
if(doc.isPresent()) {
return doc.get();
}else {
return null;
}
}
public String save() {
documentDAO = new DocumentDAO();
System.out.println("Saving Document (" + this.getTitle() + ")...");
documentDAO.update(this);
if(this.error == null || this.error.isEmpty())
return "/list?faces-redirect=true";
else
return "edit";
}
는 "testok"에 의해, 예를 들어 "테스트"를했다, "testok"이 post html 요청으로 전송되었음을 알 수 있음에도 불구하고 "문서 저장 중 ..."이 아닌 "문서 저장 중 ..." 네비게이터의 웹 개발 패널 사용). 양식 안에 양식이 없습니다.