<%@ page language="java" import="controller.*;,java.net.*,java.text.*,java.sql.*, java.util.ArrayList" %>
<html>
<body bgcolor="#ffffff">
<%
// Initialize the array of available products.
Connection conn=JavaConnect.ConnectDb();
PreparedStatement pst=conn.prepareStatement("SELECT * FROM products");
ResultSet rs = pst.executeQuery();
ArrayList<model.Item> catalog = new ArrayList();
while(rs.next()){
catalog.add (new model.Item(rs.getString(1), rs.getInt(2),rs.getString(3),rs.getString(4),rs.getInt(5),rs.getInt(6),rs.getInt(7)));
for (int i=0; i < catalog.size(); i++) {
model.Item item = catalog.get(i);
}
}
%>
<a href="/shoppingcart/ViewShoppingCart.jsp">View Shopping Cart</a>
<p>
<h1>Available Products</h1>
<table border="1">
<tr><th>EAN</th><th>PIP</th><th>Name</th><th>Description</th><th>Supplier ID</th><th>Price</th><th>Quantity</th></tr>
<%
// Get a currency formatter for showing the price.
NumberFormat currency = NumberFormat.getCurrencyInstance();
for (int i=0; i < catalog.size(); i++)
{
model.Item item = catalog.get(i);
// Create the URL for adding the item to the shopping cart.
String addItemURL =
"/shoppingcart/AddToShoppingCartServlet?"+
"productCode="+URLEncoder.encode(item.getEAN())+
"&description="+URLEncoder.encode(item.getDescription())+
"&quantity="+URLEncoder.encode(""+item.getQuantity())+
"&price="+URLEncoder.encode(""+item.getPrice());
%>
<tr><td><%=item.getDescription()%></td><td><%=item.getQuantity()%>
</td><td><%=item.getPrice()%></td>
<td><a href="<%=addItemURL%>">Add to Shopping Cart</a></td></tr>
<%
}
%>
</table>
</body>
</html>
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 14 in the generated java file
Syntax error on token ";", delete this token
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:644)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
ArrayListを使用した後、この新しいエラーが発生します。これを修正して、データベースから製品を表示するにはどうすればよいですか。コードとスタックトレースに新しい編集を含めました。14行目がどの行を参照しているのかわかりません。