• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Please help me ..

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
=========================
Exception i am getting as
=========================
exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean under name statelist2
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1078)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:295)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:396)
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:347)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean under name statelist2
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.administrator_005f1_jsp._jspService(administrator_005f1_jsp.java:493)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1078)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:295)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:396)
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:347)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

root cause

javax.servlet.jsp.JspException: Cannot find bean under name statelist2
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:377)
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:188)
org.apache.jsp.administrator_005f1_jsp._jspx_meth_html_005foptions_005f0(administrator_005f1_jsp.java:592)
org.apache.jsp.administrator_005f1_jsp._jspx_meth_html_005fselect_005f0(administrator_005f1_jsp.java:524)
org.apache.jsp.administrator_005f1_jsp._jspService(administrator_005f1_jsp.java:325)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1078)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:295)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:396)
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:347)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)



==================
administrator.jsp
==================
........
.......
<html:link action="/addadminstratorfun" ><img src="images/wpmhome.gif" width="158" height="30" border="0"></html:link>
.........
........






=================
struts-config.xml
=================

<form-beans>
<form-bean name="adminstratorform" type="com.myapp.struts.adminstratorform"/>
</form-beans>

<action-mappings>
<action name="adminstratorform" path="/addadminstratorfun" scope="request" type="com.myapp.struts.adminstrator_InitAction" validate="false">
<forward name="success" path="/administrator_1.jsp"/>
</action>
</action-mappings>



============================
adminstrator_InitAction.java
============================

package com.myapp.struts;

import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class adminstrator_InitAction extends org.apache.struts.action.Action {

private static final String SUCCESS = "success";

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

adminstratorform formbean= (adminstratorform)form;

ArrayList stateList1=new ArrayList();

stateList1= formbean.getStatelist();

request.setAttribute("statelist2",stateList1);

return mapping.findForward(SUCCESS);
}
}


=====================
adminstratorform.java
=====================

package com.myapp.struts;

import java.sql.*;
import java.sql.DriverManager;
import java.util.ArrayList;

public class adminstratorform extends org.apache.struts.action.ActionForm {

private ArrayList statelist;

public ArrayList getStatelist() {
return statelist;
}

public void setStatelist(ArrayList statelist) {
this.statelist = statelist;
}

public adminstratorform() {
try {
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/online", "root", "excellence");

Statement stmt = con.createStatement();
String sql = "select statename from state";

ResultSet rs;
rs = stmt.executeQuery(sql);

statebean s = new statebean();
statelist = new ArrayList();

int i = 1;
while (rs.next()) {
String state = rs.getString(i);
s.setState1(state);
statelist.add(s);
s = new statebean();
}
}
catch (Exception e) {
System.out.println(e);
}
}
}


==============
statebean.java
==============

package com.myapp.struts;

public class statebean extends org.apache.struts.action.ActionForm {

private String state1;
public String getState1() {
return state1;
}

public void setState1(String state1) {
this.state1 = state1;
}
public statebean() {
super();

}
}


===================
administrator_1.jsp
===================

<table>
<tr>
td> State Name:</td>
<td><html:select property="states">
<html:option value="">--Select--</html:option>
<html:options collection="statelist2" property="state1" ></html:options>
</html:select>
</td>
<tr>
</table>





































 
Sheriff
Posts: 67641
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags and UseAMeaningfulSubjectLine.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
plase do the appropiate mapping ion struts-config.xml and web.xml
 
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please use Code Tags as mentioned by Bear Bibeault. Its really awkward to read your code.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic