Organizational Research By

Surprising Reserch Topic

populating dropdown with database entries


populating dropdown with database entries  using -'I,am,trying,to,poulate,the,database,GroupNames,in,my,dropdown,using,servlets.
How,to,do,it?,Please,help

In,my,jsp,file,am,having,,:,

,<%
ArrayList<String>,list1,=,(ArrayList<String>)request.getAttribute("res1");
,%>
<select,name="GName",>
<%
,,,,for(String,list:list1),,
{,%>
<option><%=list%></option>

<%,},
%>

In,my,servlet,i,fetched,all,the,database,names,in,an,arraylist,like,this,:,

,,,ArrayList<String>,list,=,new,ArrayList<String>();
,,,,,,,,,,,,out.println("HI,GROUP,MEMBER");
,,,,,,,,,,,,String,query="Select,GNAME,from,tbGroup";
,,,,,,,,,,,,ps,=,con.prepareStatement(query);
,,,,,,,,,,,,rs=ps.executeQuery();
,,,,,,,,,,,,while(rs.next()){
,,,,,,,,,,,,,,,,list.add(rs.getString("GNAME"));

,,,,,,,,,,,,}
,,,,,,,,,,,,String[],arr1,=,list.toArray(new,String[list.size()]);
,,,,,,,,,,,,request.setAttribute("res1",arr1);

,,,,,,,,,,,,int,i;
,,,,,,,,,,,,for(i=0;i<list.size();i++){
,,,,,,,,,,,,,,,,out.println(arr1[i]);
,,,,,,,,,,,,}

Now,am,getting,null,pointer,exception,in,it.Please,help,what,can,be,the,reason,for,it,?

Here,is,complete,error,:,,

Stacktrace:],with,root,cause
java.lang.NullPointerException
at,org.apache.jsp.GroupLoginScreen_jsp._jspService(GroupLoginScreen_jsp.java:91)
at,org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at,javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at,org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
at,org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at,org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
at,javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at,org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at,org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at,org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at,org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at,org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at,org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at,org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at,org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at,org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at,org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at,org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at,org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at,org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at,org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
at,org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at,org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at,java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at,java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at,java.lang.Thread.run(Thread.java:722)'
asked Oct 19, 2015 by virendra.bajaj
edited Oct 19, 2015 by rajesh
0 votes
4 views



Related Hot Questions



Government Jobs Opening


...