struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CRANFORD, CHRIS" <Chris.Cranf...@setech.com>
Subject RE: Get single value from a row with displaytag and struts 2
Date Mon, 15 Jun 2015 22:27:28 GMT
It sounds to me like you're submitting the row object rather than the ID of the object for
which you want to operation upon.

The following example should work:

<display:table name="notifications" uid="tableListUid">
  <display:column>
    <s:form action="acknowledgeDocumentNotification">
      <s:hidden name="documentId" value="%{#tableListUid.documentId}"/>
      <s:submit key="button.submit"/>
    </s:form>
  </display:column>
</display:table>

The above code gets the document id from the uid specified and uses it as a hidden value in
the form submission. There are other neat way to avoid having a form per row, but this is
simple enough.

Your acknowledgeDocumentNotification action should then only receive the documentId parameter
with the row's document id as the only input value.

Thanks,
Chris

-----Original Message-----
From: Christoph Nenning [mailto:Christoph.Nenning@lex-com.net] 
Sent: Monday, June 08, 2015 5:50 AM
To: Struts Users Mailing List
Subject: Re: Get single value from a row with displaytag and struts 2

> From: Álex Basoa <axisbas@gmail.com>
> To: user@struts.apache.org,
> Date: 03.06.2015 09:33
> Subject: Get single value from a row with displaytag and struts 2
> 
> i have a table wich works perfect made with struts 2 and displaytag
> 
>         <display:table name="session.listaNotificaciones" 
excludedParams="*"
>                    requestURI="navegarNuevoEnvio.action" 
class="tablacoin"
>                    summary="Listado de Notificaciones" cellspacing="0"
> cellpadding="0"
>                    uid="listaContatosTable">
> 
> 
>         <display:column title="Estado" sortProperty="estado_Nue"
>                                 sortable="false"
> headerClass="sortable" defaultorder="descending"
>                                 style="width:12% ;color:red">
> 
>                     <s:property
> 
> value="%
> {@registradores.utiles.enumerados.EstadoTramite@convertirTexto
> (#attr.listaContatosTable.estado_Nue)}"
> />
> 
>                 </display:column>
> 
> 
>         <display:column title="Archivo"  headerClass="sortable"
> sortable="false" defaultorder="descending"
>                         style="width:12% ;color:black">
>             <s:hidden key="estado"
> value="%{#attr.listaContatosTable.estado_Nue}" />
>             <s:submit id="botonNotificacion" value="Notificación"
>                       cssClass="boton"
> onclick="enviarA('descargarDocumentoNotificacionAcuse.action')"/>
>         </display:column>
> 
> The problem is that i have declared in the action
> 
>     private String estado;
> 
> And i get all values from estado_Nue, but i only need the value wich i
have
> "clicked"
> 
> Thx for all your help



hi,

not sure if i understand what the problem is. You get all items of a list posted when you
submit your form? How does the html look like? What form elements are generated by display?


regards,
Christoph

This Email was scanned by Sophos Anti Virus


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message