How can i create a link in displaytag?
Asked Answered
C

5

5

I want to create edit , delete link in display tag with struts2. How can i do so ? If anybody knows please help me ....

i am doing this.

<display:column property="id" title="ID" href="details.jsp" paramId="id" />

but the link is not going to details.jsp .It doesn't go anywhere . what can be the possible reason

Corrasion answered 25/4, 2009 at 12:51 Comment(2)
Where is the link going? What url you see in browser when you click the link?Huoh
What do you mean by doesn't go anywhere? What url you see in the browser? Also you can check the view source to see what url generated.Huoh
C
5

It is done by the following code.

<display:column  title="Edit">
                    <s:url id="updateUrl" action="marketing/update.action">
                        <s:param name="id" value="#attr.countrylist.id" />
                    </s:url>
                    <s:a href="%{updateUrl}" theme="ajax"  targets="countrylist">Update</s:a>
                </display:column>

Thanks for all the answers

Corrasion answered 28/4, 2009 at 5:29 Comment(0)
C
8

You can write your stuff within the tag like this:

<display:table id="row" >
    <display:column property="id" title="ID" paramId="id"  > 
        <a href="details.jsp?${row.id}">Details</a>
    </display:column>
</display:table>
Carcinomatosis answered 27/4, 2009 at 14:59 Comment(1)
For me too its not working, link is not visible only printing propertyEquanimity
C
5

It is done by the following code.

<display:column  title="Edit">
                    <s:url id="updateUrl" action="marketing/update.action">
                        <s:param name="id" value="#attr.countrylist.id" />
                    </s:url>
                    <s:a href="%{updateUrl}" theme="ajax"  targets="countrylist">Update</s:a>
                </display:column>

Thanks for all the answers

Corrasion answered 28/4, 2009 at 5:29 Comment(0)
R
2
<display:table id="listaProgramas" name="programas" uid="tb" 
                                        pagesize="10" export="false" requestURI="/paginarProgramas.do"
                                        class="ui-widget ui-widget-content">

                                    <display:column title="Fecha de creaci&#243;n" property="fechaCreacionFormato" sortable="true"/>
                                    <display:column title="Fecha de modificaci&#243;n" property="fechaModificacionFormato" sortable="true"/>
                                    <display:column title="Empresa" property="nombreGrupoEmpresa"/>
                                    <display:column title="Usuario" property="codUsuarioCreacion"/>
                                    <display:column title="Estado" property="estadoPrograma.descripcion" />
                                    <%if(pageContext.getAttribute("tb") != null && ((Programa)pageContext.getAttribute("tb")).getEstadoPrograma().getId().equals(Constantes.ID_ESTADO_PROGRAMA_PENDIENTE)){ %>
                                    <display:column title="Modificar/Copiar" value="Modificar" url="/modificarCopiarPrograma.do" paramId="idPrograma" paramProperty="id"  style="text-align:center;"/>  
                                    <%}%> 
                                    <%if(pageContext.getAttribute("tb") != null && ((Programa)pageContext.getAttribute("tb")).getEstadoPrograma().getId().equals(Constantes.ID_ESTADO_PROGRAMA_CERRADO)){ %>
                                        <display:column title="Modificar/Copiar" value="Copiar" url="/modificarCopiarPrograma.do" paramId="idPrograma" paramProperty="id" style="text-align:center;"/>                                       
                                    <%}%>
                                    <display:column title="Reporte Financiero" value="XLS" url="/generarExcel.do" paramId="idPrograma" paramProperty="id" style="text-align:center;">
                                    <img src="image/excel.gif" alt="Descargar Excel"></img>
                                    </display:column>                                     
                                    <display:column title="Reporte Financiero PDF" value="PDF" url="/downloadPDF.do" paramId="idPrograma" paramProperty="id" style="text-align:center;">
                                    <img src="image/excel.gif" alt="Descargar Excel"></img>
                                    </display:column>
                                    </display:table>
Regulate answered 17/5, 2011 at 18:2 Comment(2)
Welcome to StackOverflow. It helps if you explain your answer in words a little bit in addition to just dumping the code.Announce
This answer using url, paramId and paramProperty is the bestSalesperson
E
1

You may have to be more specific in order to get better answers. Is the problem understanding struts2 or display tags? This tutorial expains how to create links in display tags library.

If struts 2 is the problem then you could make you question more specific and we'll see what we can do.

Eberhart answered 25/4, 2009 at 14:38 Comment(0)
S
1

You could also create a decorator for the table and have it generate the link. See example below on some other forum: http://sourceforge.net/forum/message.php?msg_id=4119964

Spectrohelioscope answered 7/7, 2009 at 23:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.