package com.yourcompany.struts.model;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
public class app extends TagSupport {
private Book[] name = null;
double money=0;
public Book[] getName() {
return name;
}
public void setName(Book[] name)
{
this.name = name;
}
public int doStartTag() throws JspException
{
JspWriter out = pageContext.getOut();
money=0;
for(int i=0;i<name.length;i++)
{
try
{
out.println("<LI>"+" "+name[i].getIsbn()+" "+name[i].getName()+" "+name[i].getPrice()+"$");
money = money + Integer.parseInt(name[i].getPrice());
} catch (IOException e)
{
e.printStackTrace();
}
}
try
{ out.println("<br>");
out.println("Total:"+money);
} catch (IOException e)
{
e.printStackTrace();
}
return SKIP_BODY;
}
}