my dog learned polymorphism*
The moose likes Struts and the fly likes Please help me .. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Please help me .. " Watch "Please help me .. " New topic
Author

Please help me ..

er gerg
Greenhorn

Joined: Jan 23, 2010
Posts: 3
=========================
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">
<htmlption value="">--Select--</htmlption>
<htmlptions collection="statelist2" property="state1" ></htmlptions>
</html:select>
</td>
<tr>
</table>






































--
With Regards,
Rohan G

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Please UseCodeTags and UseAMeaningfulSubjectLine.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
tamnna arzoo
Greenhorn

Joined: Mar 23, 2010
Posts: 23
plase do the appropiate mapping ion struts-config.xml and web.xml
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Please use Code Tags as mentioned by Bear Bibeault. Its really awkward to read your code.


Never try to be a hard-worker. Be a smart-worker.
My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help me ..
 
Similar Threads
Please help me ..
Struts1 - tiles -cascading tiles:insert
Strange behavior of Tomcat! "classFile.delete() failed"
Tiles 2 - Tomcat Errors etc
Cannot find bean under name org.apache.struts.taglib.html.BEAN