RE: how to change this logic into tags
This could/should be put into an Action /* ArrayList al = (ArrayList) request.getAttribute(al); if (al != null) { for (int i=0;ial.size()/2;i++) { SystemProfileData spd = (SystemProfileData) al.get(i); if (i==0) int topmsg = spd.getSentCount(); */ The spd.getSentCount() should give u the correct top message. No need to count it. But if you can't then you could either create a new property which shows this or create a bean which you could hold your values /* td width=%=topmsg!=0?spd.getSentCount()*80/topmsg:0%%/td */ for writing out properties you could use bean:write name=beanName property=propertyName / for html link html:link Look here for more info http://jakarta.apache.org/struts/userGuide/ Amin -Original Message- From: Mohd Fadhly [mailto:[EMAIL PROTECTED] Sent: Monday, September 22, 2003 12:05 PM To: Struts Users Mailing List Subject: how to change this logic into tags hello, how do i change this scriptlet logic into struts tag, % ArrayList al = (ArrayList) request.getAttribute(al); if (al != null) { for (int i=0;ial.size()/2;i++) { SystemProfileData spd = (SystemProfileData) al.get(i); if (i==0) int topmsg = spd.getSentCount(); % table border=0 width=100% trtd 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.get SentCount()%/td /table /td /tr/table % } } % - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to change this logic into tags
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;ial.size()/2;i++) { SystemProfileData spd = (SystemProfileData) al.get(i); if (i==0) int topmsg = spd.getSentCount(); % table border=0 width=100% trtd 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]