struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <hus...@apache.org>
Subject Re: how to change this logic into tags
Date Mon, 22 Sep 2003 11:15:17 GMT
Don't! =:)

Put logic in an *Action*, or in this case maybe a business class, and 
place the result in a JavaBean and use the tags to display the result. 
(Or put the logic in the JavaBean that the tags can invoke.) If you want 
to use a MVC architechture, which Struts encourages, the pages are 
viewed as output only devices. Any real processing takes place in an 
Action or in a business class invoked by the Action.

HTH, Ted.

Mohd Fadhly wrote:
> hello,
> 
> how do i change this scriptlet logic into struts tag,
> 
> <%
>            ArrayList al = (ArrayList) request.getAttribute("al");
> 
>            if (al != null) {
>                for (int i=0;i<al.size()/2;i++) {
>                    SystemProfileData spd = (SystemProfileData) al.get(i);
>                    if (i==0)
>                        int topmsg = spd.getSentCount();
> %>
>    <table border=0 width=100%>
>    <tr><td width="20%"><%=spd.getName()%></td>
>    <td>
>        <table border=0 width=100% cellspacing="0" cellpadding="0">
>            <td width="<%=topmsg!=0?spd.getSentCount()*80/topmsg:0%>%"></td>
>            <td 
> width="<%=topmsg!=0?100-(spd.getSentCount()*80/topmsg):0%>%">><%=spd.getSentCount()%></td>

> 
>        </table>
>    </td>
>    </tr></table>
> <%                 }
>            }
> %>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.

"Get Ready, We're Moving Out!!" - <http://www.clark04.com>



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


Mime
View raw message