私DrawingBean
は
public class DrawingBean {
String drawingTitle;
public String getDrawingTitle() {
return drawingTitle;
}
public void setDrawingTitle(String drawingTitle) {
this.drawingTitle = drawingTitle;
}
}
JSFには、タグdrawingPatentss.xhtml
内に以下を含むページがあります。h:form
<h:inputText value="#{PersonalInformationDataBean.drawingTitle}" size="80" id="drawingTitle" />
<h:commandButton value="Upload More Drawing" action="# {PersonalInformationDataBean.checkMyDrawingPageData()}" />
<h:dataTable id="patentDrawingList" var="patentDrawingList" value="#{PersonalInformationDataBean.drawingList}" border="1" width="30%">
<h:column>
<f:facet name="header">
<h:outputText value="Drawing Title" />
</f:facet>
<h:outputText value="#{patentDrawingList.drawingTitle}"/>
<h:commandButton value="Delete" action="#{PersonalInformationDataBean.removeDataFromDrawingList()}">
<f:setPropertyActionListener target="#{PersonalInformationDataBean.drawingTitle}" value="#{patentDrawingList.drawingTitle}" />
</h:commandButton>
</h:column>
</h:dataTable>
PersonalInformationDataBean.java
私は持っています
private List<DrawingBean> drawingList = new ArrayList<DrawingBean>();
private String drawingTitle;
DrawingBean drawingBean;
// getter and setter for all of above.
public String checkMyDrawingPageData() {
drawingBean = new DrawingBean();
drawingBean.setDrawingTitle(drawingTitle);
drawingList.add(drawingBean);
return "drawingPatentss?faces-redirect=true";
}
public String removeDataFromDrawingList() {
drawingBean = new DrawingBean();
drawingBean.setDrawingTitle(drawingTitle);
boolean removedStatus = false;
removedStatus = drawingList.remove(drawingBean);
System.out.println("removed status === " + removedStatus);
return "drawingPatentss?faces-redirect=true";
}
ただし、Beanはリストから削除されていません...
ただし、に以下の行を追加するremoveDataFromDrawingList()
と、リストが更新されます。
drawingBean = new DrawingBean();
drawingBean.setDrawingTitle("Temp Title");
drawingList.add(drawingBean);
リクエストBeanがリストから削除されない理由。
どんな助けでも本当にありがたいです。