VallePJ
Fevereiro 16, 2005, 3:16pm
#1
boa tarde estou tentando usar o Displaytag, mas não está funcionando !!
gostaria de saber se alguem tem algum exemplo (com struts)que poderia mostrar ??
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix=“logic” %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix=“html” %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix=“bean” %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix=“tiles” %>
<tiles:insert page="/layouts/layout.jsp" flush=“true”>
<tiles:put name=“title” type=“string”>
<bean:message key=“app.title” />
</tiles:put>
<tiles:put name=“header” value="/tile/header.jsp" />
<tiles:put name=“body” type=“string” >
<html:html locale=“true”>
<center>
<font color=‘blue’ size=“5”>
<center>
<h3><font color=“blue”><bean:message key=“app.title”/></font></h3>
</center>
</font>
<table width=“80%” border=“1”>
<tr>
<th width=“20%”><bean:message key=“prompt.id ”/></th>
<th width=“50%”><bean:message key=“prompt.Nome”/></th>
<th width=“20%”><bean:message key=“prompt.Tel”/></th>
</tr>
<%-- loop que percorre a Collection de usuarios --%>
<logic:iterate name=“arrayList” id=“arrayList” >
<tr>
<td align=“center”>
<bean:write name=“arrayList” property=“id”/>
</td>
<td><bean:write name=“arrayList” property=“nome”/></td>
<td><bean:write name=“arrayList” property=“tel”/></td>
</tr>
</logic:iterate>
</table>
</center>
<br><br>
<A href=“index.jsp”> <img src=“imag/return.gif” width=“25” height=“10”> </a>
</html:html>
</tiles:put>
<tiles:put name=“footer” value="/tiles/footer.jsp" />
<tiles:put name=“menu” value="/tiles/menu.jsp" />
</tiles:insert>
vou ter que tirar meu <logic:iterate>
e ai Valle?
<display:table name="reincidencia" export="true" sort="list" pagesize="20">
<display:column property="alarmNumber" sortable="true" title="Alarm Number"/>
<display:column property="neID" sortable="true" title="NE ID"/>
<display:column property="count" sortable="true" title="Total de alarmes"/>
<display:column property="primeiroAlarmTime" sortable="true" title="Alarm Time Inicial"/>
<display:column property="primeiroAlarmTime" sortable="true" title="Alarm Time Final"/>
</display:table>
vou tentar te explicar usando o código acima. pra vc poder mostrar a sua tabela, vc precisa colocar os valores que vc que mostrar em uma lista. No exemplo, eu to usando uma lista chamada reincidência, que eu populei na minha action, assim:
A displaytag procurar uma lista no request com o nome que vc colocar em name. Na minha lista cada elemento é um objeto que contém os metodos get/set correspondentes aos valores do column property .
Não sei se fui claro, mas acho que já da pra vc mostrar a sua lista…
Qualquer dúvida pode perguntar, e se alguém quiser complementar o que eu disse fique a vontade…
Abraço!
VallePJ
Fevereiro 16, 2005, 4:40pm
#3
Obrigado !!!
Eu já tinha feito isso !!! mas não deu certo !!! tentei novamente e não deu certo !!!
não sei se foi minha configuração no web.xml ou os jar1s que coloquei ???
fica com este erro
Starting service Tomcat-Standalone
Apache Tomcat/4.1.24
log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).
log4j:WARN Please initialize the log4j system properly.
mas acho que não afeta !?!??!?!?
pergunta no web.xml fica assim ???
taglib>
<taglib-uri>/WEB-INF/displaytag-11.tld</taglib-uri>
<taglib-location>/WEB-INF/displaytag-11.tld</taglib-location>
</taglib>
e na jsp assim ??
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix=“displaytag” %>
no web.xml eu tb coloquei dessa maneira, e no arquivo jsp ficou assim:
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix=“display” %>
e a mensagem de erro que vc colocou acho que tb não interfere…
VallePJ
Fevereiro 16, 2005, 5:05pm
#5
Cara muito obrigado era mesmo só prefix=“display”, mudei no meu e funcionou bacana !!!
Agora como é para colocar cor …etc… ??? (desculpe estar perguntando mais)