我正在开发一个 Java 应用程序 eInvoice 应用程序。应用程序的目的是添加电子发票,然后显示我添加的电子发票(在这里工作得很好)。但是,当我显示发票时,我希望公司名称被超链接,并且在单击链接后,特定发票详细信息应显示在 Jsp 页面中。请注意,我将信息传递给 servlet,然后使用 getter 和 Setter 将信息存储在 java 类中。多条记录存储在 Arraylist 对象中。我似乎找不到这样做的方法。任何帮助是极大的赞赏。
<%
float bigTotal=0;
try
{
@SuppressWarnings("unchecked")
ArrayList<UserInvoice> myVal = (ArrayList<UserInvoice>)session.getAttribute("eInvoice");
out.write("<table border='0'>");
out.write("<th width='200'>Invoice No.</th><th width='300'>Client Name</th> <th width='200'>Total</th><th width='200'>Payment Due Date</th>");
for(UserInvoice invoices:myVal)
{
out.write("<tr>");
out.write("<td height='25'>");
out.write(""+invoices.getInvoiceNo());
out.write("</td>");
out.write("<td>");
out.write(invoices.getClientName());
out.write("</td>");
out.write("<td>");
out.write(String.valueOf(invoices.getTotal()));
out.write("</td>");
out.write("<td>");
out.write(invoices.getPayDueDate());
out.write("</td>");
out.write("</tr>");
bigTotal = bigTotal+invoices.getTotal();
}
out.write("</table>");
}
catch(Exception ex)
{
out.write("<h1>Looks like you haven't added any invoices yet.</h1>");
}