2010-03-02 6 views
0

Я использую displaytag в списке bean: utilisateurBean. Мне нужно добавить столбец на этой вкладке, чтобы добавить флажок для выбора элемента.displaytag, как интегрировать флажки?

Pb: С displaytag стойки ищет недвижимость choixUtilisateur в фасоли, а не в formBean. Есть ли способ поговорить struts/displaytag, чтобы отобразить это свойство в форме? Я не понимаю сочетание слоя пресвещения/бизнес-уровня, к которому это относится.

Я понимаю, что я перебираю фасоль и что он ищет свойство. Но я не понял отображение свойства декоратора в бизнес-слое.

Мой код:

<html:form action="/rechercheUtilisateur" 
    name="formRechercheUtilisateur" 
     decorator="org.displaytag.render.DecorateurCheckbox" 
    type="lan.poujoulat.osac.forms.FormRechercheUtilisateur"> 
... 

    <div align="center"><display:table style="width: 100%;" 
    class="mars" sort="list" 
    name="formRechercheUtilisateur.listeUtilisateurs" 
    id="formRechercheUtilisateur.listeUtilisateurs" 
     decorator="org.displaytag.render.DecorateurCheckbox" 
    cellspacing="4" cellpadding="2" pagesize="10" 
    requestURI="rechercheUtilisateur.do" export="true" > 
    <display:column title="id" property="id" sortable="true" 
     style="color: black;" headerClass="sortable"></display:column> 
    ... 
    <display:column media="html" property="choixUtilisateur" title="&nbsp;"></display:column> 
... 
    </display:table></div> 
</html:form> 

DecorateurCheckbox.java добавить флажок мой счет:

public class DecorateurCheckbox extends TableDecorator{ 
... 
    public String getChoixUtilisateur() 
    { 
     String retour = ""; 
     UtilisateurBean user= (UtilisateurBean) getCurrentRowObject(); 
     int idUser ; 

     idUser = user.getId(); 

     retour = "<input type='checkbox' name='formRechercheUtilisateur' property='choixUtilisateur' value='"+idUser+"' id='selectedArticle" + idUser + "' />"; 

     return retour; 
    } 
... 
} 

Ошибка:

/Administration/acces.jsp. Exception : javax.servlet.ServletException: Error looking up property "choixUtilisateur" in object type "xxx.UtilisateurBean".

ответ

0
public class DecorateurCheckbox extends TableDecorator{ 
    public String getChoixUtilisateur() 
    { 
    String retour = ""; 
    UtilisateurBean user= (UtilisateurBean) getCurrentRowObject(); 
    int idUser ; 

    idUser = user.getId(); 

    retour = "<input type='checkbox' name='utilisateurModif' property='choixUtilisateur' value='"+idUser+"' id='" + idUser + "' />"; 

    return retour; 
    } 
} 

utilisateurModif является формой собственности и choixUtilisateur является рассылку свойство laytag с декоратором: jsp:

<display:column property="choixUtilisateur" title="modif"></display:column> 
Смежные вопросы