newbie2
08-21-2005, 06:26 AM
Hi There,
I am going thru the doc at http://www.laszlosystems.com/lps-3.0/docs/guide/data_app.html and am using this to help me get JSP and Laszlo talking :-)
I am unfortunately getting errors on the JSP example(s) that was given in Chapter 33, section 6 ... Has anyone got a working example of JSP formatting DB output for XML working that they would be willing to share?
Here is my JSP code and the error:
<%@ page import="java.sql.*"%>
<%
Connection connetion=null;
try {
String u_login=request.getParameter("u_login");
Class.forName("org.postgresql.Driver");
Connection db =DriverManager.getConnection("jdbc:postgresql:dbName","postgres","password");
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM t_user WHERE u_login='"+u_login+"';");
while (rs.next()) {
%>
<t_user firstName="<%= rs.getString("u_fname")%>"
lastName="<%= rs.getString("u_lname")%>"
userTypeId="<%= rs.getString("u_typeid")%>"
userSportId="<%= rs.getString("u_sportid")%>"
userLevelId="<%= rs.getString("u_levelid")%>"/>
<%
}
}
finally {
try{
connection.close();
}
}
%>
Error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 24 in the jsp file: /peak/getworkoutdetailsXML.jsp
Generated servlet error:
Syntax error, insert "Finally" to complete BlockStatements
org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:389)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:288)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:267)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:255)
org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:296)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.runtime.PageContextImpl.doForwar d(PageContextImpl.java:690)
org.apache.jasper.runtime.PageContextImpl.forward( PageContextImpl.java:657)
org.apache.jsp.peak.validate_jsp._jspx_meth_c_when _0(org.apache.jsp.peak.validate_jsp:516)
org.apache.jsp.peak.validate_jsp._jspx_meth_c_choo se_0(org.apache.jsp.peak.validate_jsp:482)
org.apache.jsp.peak.validate_jsp._jspService(org.a pache.jsp.peak.validate_jsp:123)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
I am going thru the doc at http://www.laszlosystems.com/lps-3.0/docs/guide/data_app.html and am using this to help me get JSP and Laszlo talking :-)
I am unfortunately getting errors on the JSP example(s) that was given in Chapter 33, section 6 ... Has anyone got a working example of JSP formatting DB output for XML working that they would be willing to share?
Here is my JSP code and the error:
<%@ page import="java.sql.*"%>
<%
Connection connetion=null;
try {
String u_login=request.getParameter("u_login");
Class.forName("org.postgresql.Driver");
Connection db =DriverManager.getConnection("jdbc:postgresql:dbName","postgres","password");
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM t_user WHERE u_login='"+u_login+"';");
while (rs.next()) {
%>
<t_user firstName="<%= rs.getString("u_fname")%>"
lastName="<%= rs.getString("u_lname")%>"
userTypeId="<%= rs.getString("u_typeid")%>"
userSportId="<%= rs.getString("u_sportid")%>"
userLevelId="<%= rs.getString("u_levelid")%>"/>
<%
}
}
finally {
try{
connection.close();
}
}
%>
Error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 24 in the jsp file: /peak/getworkoutdetailsXML.jsp
Generated servlet error:
Syntax error, insert "Finally" to complete BlockStatements
org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:389)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:288)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:267)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:255)
org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:296)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.runtime.PageContextImpl.doForwar d(PageContextImpl.java:690)
org.apache.jasper.runtime.PageContextImpl.forward( PageContextImpl.java:657)
org.apache.jsp.peak.validate_jsp._jspx_meth_c_when _0(org.apache.jsp.peak.validate_jsp:516)
org.apache.jsp.peak.validate_jsp._jspx_meth_c_choo se_0(org.apache.jsp.peak.validate_jsp:482)
org.apache.jsp.peak.validate_jsp._jspService(org.a pache.jsp.peak.validate_jsp:123)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)