wood burning stoves 2.0*
The moose likes Other Application Frameworks and the fly likes spring/jsp -exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "spring/jsp -exception" Watch "spring/jsp -exception" New topic
Author

spring/jsp -exception

kanna kesavan
Greenhorn

Joined: May 09, 2005
Posts: 6
Hi,

I am getting a new exception which i have never faced before.kindly help me.I am using spring in jsp.This program works well if i run as stand alone program.i.e using main method .I have given my code and the exception is below:

<%@page import="java.util.*,javax.sql.*,javax.naming.*,org .springframework.jdbc.core.*" %>
<%@page import="org.springframework.jdbc.support.rowset.Sq lRowSet"%>
<%@page import="org.springframework.jdbc.support.rowset.Sq lRowSetMetaData" %>
<%!public List doSelect(String query)throws NamingException {
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

Context ctx = new InitialContext(env);
DataSource datasource= (DataSource) ctx.lookup("OracleDS");

JdbcTemplate jt = new JdbcTemplate(datasource);
SqlRowSet rowset = jt.queryForRowSet(query);
SqlRowSetMetaData rsmd = rowset.getMetaData();
int colCount = rsmd.getColumnCount();
System.out.println("colCount: " + colCount);

ArrayList rows = new ArrayList();
ArrayList list;
while (rowset.next()) {
list = new ArrayList();
for (int i = 1; i <= colCount; i++) {
list.add(rowset.getObject(i));
}
rows.add(list);
}
return rows;
}
%>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<h1 align="center">Welcome Admin</h1>
<form name="tableName" action="one" method="POST">
<%
List rows=doSelect("select * from tab where tabtype like 'SYNONYM'");
Iterator it=rows.iterator();
while(it.hasNext()){
ArrayList disp=(ArrayList)it.next();
Iterator it1=disp.iterator();
while(it1.hasNext()){
String str = (String)it1.next();
out.println("<option value=" + str + ">" + it1.next() + "str1"+ "</option>");
}
}
%>
</form>
</body>
</html>

OUTPUT:
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:81)


root cause

java.util.NoSuchElementException
java.util.AbstractList$Itr.next(AbstractList.java: 422)
org.apache.jsp.AdminUI_jsp._jspService(org.apache. jsp.AdminUI_jsp:107)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:81)
 
Don't get me started about those stupid light bulbs.
 
subject: spring/jsp -exception