You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Fabio Perfetti <pe...@gmail.com> on 2010/06/19 12:01:12 UTC

Problem with iterator and images

Hi all, before to start, i want say sorry for my bad english.
I am developing an easy social network for a university project

Every User has an image for the profile.

I want to list all friends, and i want display Name, Surname and the image.
So i have an action that retrieve the list of friends:

public String list() {
Utente utente;
utente = (Utente) session
.get(AuthenticationInterceptor.authenticationSessionField);
utenteDao.update(utente.getId());
setListaAmici(utente.getListaAmici());
System.out.println("total friends: " + listaAmici.size());
return SUCCESS;
}

Now I have a list of Users. So in my jsp:

friends : <s:property value="listaAmici.size" />
<br />
<s:iterator value="listaAmici" var="amico">
<s:url value="%{#amico.fotoProfilo.path}" />
<img src="" width="200" />
<s:property value="#amico.nome" /> <s:property value="#amico.cognome" />
</s:iterator>

I don't know how do it!
The database save the name of the image.

Sorry for my bad english.
Thanks
Fabio

Re: Problem with iterator and images

Posted by Fabio Perfetti <pe...@gmail.com>.
Thanks Brian!!
I resolved!!

<s:iterator value="album.listaFoto" var="foto">
<s:url id="_foto" action="show" namespace="/foto">
<s:param name="foto.id" value="#foto.id"/>
</s:url>
<s:url value="%{'/images/'+ #foto.path}" includeParams="none"
id="img_foto"></s:url>
<div class="amico">
<img src="<s:property value="img_foto"/>" width="50" /><br />
<s:a href="%{_foto}"><s:property value="#foto.path"/></s:a>
</div>
</s:iterator>

Thanks a lot!!

2010/6/19 Brian Thompson <el...@gmail.com>

> <img src="<s:property value="%{idOfsUrl}" />" />
>
> Brian
>
> On Jun 19, 2010 5:01 AM, "Fabio Perfetti" <pe...@gmail.com> wrote:
>
> Hi all, before to start, i want say sorry for my bad english.
> I am developing an easy social network for a university project
>
> Every User has an image for the profile.
>
> I want to list all friends, and i want display Name, Surname and the image.
> So i have an action that retrieve the list of friends:
>
> public String list() {
> Utente utente;
> utente = (Utente) session
> .get(AuthenticationInterceptor.authenticationSessionField);
> utenteDao.update(utente.getId());
> setListaAmici(utente.getListaAmici());
> System.out.println("total friends: " + listaAmici.size());
> return SUCCESS;
> }
>
> Now I have a list of Users. So in my jsp:
>
> friends : <s:property value="listaAmici.size" />
> <br />
> <s:iterator value="listaAmici" var="amico">
> <s:url value="%{#amico.fotoProfilo.path}" />
> <img src="" width="200" />
> <s:property value="#amico.nome" /> <s:property value="#amico.cognome" />
> </s:iterator>
>
> I don't know how do it!
> The database save the name of the image.
>
> Sorry for my bad english.
> Thanks
> Fabio
>

Re: Problem with iterator and images

Posted by Brian Thompson <el...@gmail.com>.
<img src="<s:property value="%{idOfsUrl}" />" />

Brian

On Jun 19, 2010 5:01 AM, "Fabio Perfetti" <pe...@gmail.com> wrote:

Hi all, before to start, i want say sorry for my bad english.
I am developing an easy social network for a university project

Every User has an image for the profile.

I want to list all friends, and i want display Name, Surname and the image.
So i have an action that retrieve the list of friends:

public String list() {
Utente utente;
utente = (Utente) session
.get(AuthenticationInterceptor.authenticationSessionField);
utenteDao.update(utente.getId());
setListaAmici(utente.getListaAmici());
System.out.println("total friends: " + listaAmici.size());
return SUCCESS;
}

Now I have a list of Users. So in my jsp:

friends : <s:property value="listaAmici.size" />
<br />
<s:iterator value="listaAmici" var="amico">
<s:url value="%{#amico.fotoProfilo.path}" />
<img src="" width="200" />
<s:property value="#amico.nome" /> <s:property value="#amico.cognome" />
</s:iterator>

I don't know how do it!
The database save the name of the image.

Sorry for my bad english.
Thanks
Fabio