Struts2, convert s: select a list to display the Tag column

I have the following select list in jsp:

<td>
    <s:select list = "models" 
         listValue = "modelName"
           listKey = "modelId" 
          multiple = "true" 
              name = "models" />
</td>

I decided to implement pagination using the library display Tag, so I want to convert it to a display column and show one or more models from the list. How can i do this? Below is a mapping table with other columns:

<display:table name = "cars" 
         requestURI = "/listCar.action" 
           pagesize = "10">

     <display:column property = "name" title = "name" />

     <display:column titleKey = "models" >
         <!--------------model list?-------------->
     </display:column> 

     <display:column property = "year"  title = "year" />

</display:table>
+4
source share
1 answer

First of all, you need to make the DisplayTag by pressing a value in a context that you can access:

Implicit Objects Created by a Table


  id , , , . , , id_rowNum.

( pageContext.getAttribute("id")). ( <%=id%>), id . - pageContext.getAttribute().

id, pageContext


. Struts2 pageContext #attr:

Struts 2 :


 #attr['foo'] #attr.foo

pageContext, , request/session/application


, :

<display:table   id = "currentRowInPageContext"
               name = "cars" 
         requestURI = "/listCar.action" 
           pagesize = "10">

     <display:column property = "name"  title = "name" />

     <display:column titleKey = "models" >
         <s:select list = "%{#attr.currentRowInPageContext.models}" 
              listValue = "modelName"
                listKey = "modelId" 
               multiple = "true" 
                   name = "models" />
     </display:column>                                                

     <display:column property = "year" title = "year" />

</display:table>


, DisplayTag, jQuery DataTables jQuery jqGrid; (struts2-jquery-grid-plugin), , , , struts2 .

+4

All Articles