데이터 테이블의 데이터를 requestscope와 동일한 백킹 빈을 사용하여 다른 페이지로 전달하려면 datamodel을 사용하지 않고이 작업을 수행 할 수 있습니까? 여기 서블릿 3.0jsf 다른 페이지로의 데이터 전달이 작동하지 않습니다.
를 사용하고있어 여기 내 데이터 테이블 페이지
<p:dataTable var="entity" value="#{collegeController.allCollege}">
<p:column headerText="Code">
#{entity.collegeCode}
</p:column>
<p:column headerText="Description">
#{entity.collegeDesc}
</p:column>
<p:column headerText="">
<p:commandLink value="Edit" action="#{collegeController.prepareEdit(entity)}"/>
</p:column>
</p:dataTable>
이고 것은 내 백업 콩
@ManagedBean
@RequestScoped
public class CollegeController implements Serializable {
private String redirect = ".jsf?faces-redirect=true";
private CollegeCatalog entity;
public CollegeController() {
}
public String prepareEdit(CollegeCatalog selectedEntity) {
Session s = NewHibernateUtil.getSessionFactory().getCurrentSession();
s.beginTransaction();
entity = (CollegeCatalog) s.load(CollegeCatalog.class, selectedEntity.getCollegeKey());
return "update" + redirect;
}
public List getAllCollege() {
Session s = NewHibernateUtil.getSessionFactory().getCurrentSession();
Transaction tx = s.beginTransaction();
String query = ""
+ "FROM CollegeCatalog entity "
+ "WHERE entity.deleted = FALSE";
Query q = s.createQuery(query);
List l = q.list();
tx.commit();
return l;
}
/**
* @return the entity
*/
public CollegeCatalog getEntity() {
if (entity == null) {
entity = new CollegeCatalog();
}
return entity;
}
/**
* @param entity the entity to set
*/
public void setEntity(CollegeCatalog entity) {
this.entity = entity;
}
}
이며,이 내 업데이트 페이지입니다 (이것은 내가 보여주고 싶은 곳이다 선택된 데이터)
<h:form>
<p:outputLabel value="Code:" for="txtCode"/>
<p:inputText id="txtCode" value="#{collegeController.entity.collegeCode}"/>
<br/>
<p:outputLabel value="Description:" for="txtDesc"/>
<p:inputText id="txtDesc" value="#{collegeController.entity.collegeDesc}"/>
<br/><br/>
<p:commandButton value="Update" action="#{collegeController.update()}"/>
<p:commandButton value="Back" action="index.jsf?faces-redirect=true"/>
</h:form>
항상 null
을 반환합니다.
작동하지 않습니다. – borj
Look at http://stackoverflow.com/questions/4994458/how-can-i-pass-a-parameter-to-a-commandlink-inside-a-datatable –
나에게 준 링크에서 # 3을 사용하고 있습니다. 당신이 내 datatable 페이지에서 볼 수 있듯이, unforunately 나를 위해 일하지 않습니다. 명확한 설명을 위해 – borj