Hi,
I am new to JSP, I have this code to query out a recordset and display it on the screen.
<html>
<head><title>Manage Products</title></head>
<body>
<%@ page import="java.sql.*"%> <jsp:useBean id = "product" class="ProductBean" scope="request" />
<jsp:setProperty name = "product" property="*"/> <%
ResultSet objRs = product.getCategory();
%>
<%
String cat;
cat = request.getParameter("cat");
if (cat=="Home"){
%>
<font color="red"><b>Home</b></font>
<%
}
else{
%>
<a href="default.jsp?cat=Home">Home</a>
<%
}
%>
<UL>
<%
while(objRs.next())
{
if (cat == <%=objRs.getString("product_category")){
%>
<Li><font color="red"><b><%=objRs.getString("product_category")%></b></font></Li>
</UL>
<%
}
 ! ;else{
%>
<ul>
<li><a href="default.jsp"><%=objRs.getString("product_category")%></a></li>
</ul>
<%
}
}
%>
</body>
</html>
I know that the bean is working fine however I got this error when I try to execute this page.
<head><title>Manage Products</title></head>
<body>
<%@ page import="java.sql.*"%> <jsp:useBean id = "product" class="ProductBean" scope="request" />
<jsp:setProperty name = "product" property="*"/> <%
ResultSet objRs = product.getCategory();
%>
<%
String cat;
cat = request.getParameter("cat");
if (cat=="Home"){
%>
<font color="red"><b>Home</b></font>
<%
}
else{
%>
<a href="default.jsp?cat=Home">Home</a>
<%
}
%>
<UL>
<%
while(objRs.next())
{
if (cat == <%=objRs.getString("product_category")){
%>
<Li><font color="red"><b><%=objRs.getString("product_category")%></b></font></Li>
</UL>
<%
}
 ! ;else{
%>
<ul>
<li><a href="default.jsp"><%=objRs.getString("product_category")%></a></li>
</ul>
<%
}
}
%>
</body>
</html>
I know that the bean is working fine however I got this error when I try to execute this page.
javax.servlet.ServletException: Compilation error occured:
allaire.jrun.scripting.DefaultCFE:
Errors reported by compiler:D:/ecommerce/WEB-INF/jsp/jrun__CatList2ejspc.java:78:28:78:30: Syntax: Unexpected input discarded
allaire.jrun.scripting.DefaultCFE:
Errors reported by compiler:D:/ecommerce/WEB-INF/jsp/jrun__CatList2ejspc.java:78:28:78:30: Syntax: Unexpected input discarded
at allaire.jrun.scripting.JavaCompilerService.compile(JavaCompilerService.java:122)
at allaire.jrun.jsp.JSPServlet.compilePage(JSPServlet.java:452)
at allaire.jrun.jsp.JSPServlet.createServlet(JSPServlet.java:393)
at allaire.jrun.jsp.JSPServlet.loadPage(JSPServlet.java:201)
at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:168)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:88)
at allaire.jrun.servlet.JRunSE.servic! e(JRunSE.java:1131)
at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
at allaire.jrun.http.WebEndpoint.run(WebEndpoint.java:107)
at allaire.jrun.ThreadPool.run(ThreadPool.java:267)
at allaire.jrun.WorkerThread.run(WorkerThread.java:74)
at allaire.jrun.jsp.JSPServlet.compilePage(JSPServlet.java:452)
at allaire.jrun.jsp.JSPServlet.createServlet(JSPServlet.java:393)
at allaire.jrun.jsp.JSPServlet.loadPage(JSPServlet.java:201)
at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:168)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:88)
at allaire.jrun.servlet.JRunSE.servic! e(JRunSE.java:1131)
at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
at allaire.jrun.http.WebEndpoint.run(WebEndpoint.java:107)
at allaire.jrun.ThreadPool.run(ThreadPool.java:267)
at allaire.jrun.WorkerThread.run(WorkerThread.java:74)
Can someone help me out.
Thanks,
Duc
Get your FREE download of MSN Explorer at http://explorer.msn.com
=========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
