Agreed.... @bhaa: You might want to read up on MVC or Model View Controller design.
Cheers, Clinton On Mon, Aug 24, 2009 at 7:23 AM, Larry Meadors <larry.mead...@gmail.com>wrote: > Good heavens, why would you EVER put that in a jsp? > > If you have to, the error is "Unable to compile class for JSP: An > error occurred at line: 1 in the generated java file The type > com.ibatis.sqlmap.client.SqlMapClient cannot be resolved. It is > indirectly referenced from required .class files" > > Looks like it can't find all the classes. > > My advice: If it hurts when you hit yourself in the head with a > hammer, then don't do it. If you can't do something you shouldn't in a > jsp, don't. ;-) > > Larry > > > On Mon, Aug 24, 2009 at 6:44 AM, bhaa<b...@yandex.ru> wrote: > > > > Hi, All. > > > > Explain to me please why it works in Application: > > > > public static void main(String[] args) { > > Reader reader = null; > > SqlMapClient client = null; > > try { > > reader = > > Resources.getResourceAsReader("com/rns/guvd/xml/SqlMapConfig.xml"); > > client = SqlMapClientBuilder.buildSqlMapClient(reader); > > reader.close(); > > } catch (IOException e) { > > e.printStackTrace(); > > } > > ... > > } > > > > but does not work in JSP: > > ... > > <%@ page > import="com.ibatis.common.resources.*,com.ibatis.sqlmap.client.*" > > %> > > ... > > <% > > SqlMapClient sqlMapClient = null; > > try { > > Reader reader = > > Resources.getResourceAsReader("com/rns/guvd/xml/SqlMapConfig.xml"); > > sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader); > > reader.close(); > > } catch (IOException e) { > > e.printStackTrace(); > > } > > ... > > %> > > > > org.apache.jasper.JasperException: Unable to compile class for JSP: > > > > > > An error occurred at line: 1 in the generated java file > > The type com.ibatis.sqlmap.client.SqlMapClient cannot be resolved. It is > > indirectly referenced from required .class files > > > > An error occurred at line: 28 in the jsp file: /test.jsp > > SqlMapClient cannot be resolved to a type > > 27: <% > > 28: SqlMapClient sqlMapClient = null; > > 29: try { > > 30: Reader reader = > > Resources.getResourceAsReader("com/rns/guvd/xml/SqlMapConfig.xml"); > > 31: sqlMapClient = > SqlMapClientBuilder.buildSqlMapClient(reader); > > > > > > An error occurred at line: 30 in the jsp file: /test.jsp > > Resources cannot be resolved > > 27: <% > > 28: SqlMapClient sqlMapClient = null; > > 29: try { > > 30: Reader reader = > > Resources.getResourceAsReader("com/rns/guvd/xml/SqlMapConfig.xml"); > > 31: sqlMapClient = > SqlMapClientBuilder.buildSqlMapClient(reader); > > 32: reader.close(); > > 33: } catch (IOException e) { > > > > > > An error occurred at line: 31 in the jsp file: /test.jsp > > SqlMapClientBuilder cannot be resolved > > 28: SqlMapClient sqlMapClient = null; > > 29: try { > > 30: Reader reader = > > Resources.getResourceAsReader("com/rns/guvd/xml/SqlMapConfig.xml"); > > 31: sqlMapClient = > SqlMapClientBuilder.buildSqlMapClient(reader); > > 32: reader.close(); > > 33: } catch (IOException e) { > > 34: e.printStackTrace(); > > > > > > Stacktrace: > > > > > org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93) > > > > > org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) > > > org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435) > > org.apache.jasper.compiler.Compiler.compile(Compiler.java:298) > > org.apache.jasper.compiler.Compiler.compile(Compiler.java:277) > > org.apache.jasper.compiler.Compiler.compile(Compiler.java:265) > > > > > org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) > > > > > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302) > > > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) > > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) > > javax.servlet.http.HttpServlet.service(HttpServlet.java:729) > > > > Explain please to me in what a problem. > > Alexander > > -- > > View this message in context: > http://www.nabble.com/Why-in-Application-is-worked%2C-but-in-JSP-don%27t-worked--tp25115452p25115452.html > > Sent from the iBATIS - User - Java mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > > For additional commands, e-mail: user-java-h...@ibatis.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > >