Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rohan Gaur
Struts
1 Answer(s)      4 years and 9 months ago
Posted in : Framework


=========================
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>






































Advertisement
View Answers

March 31, 2010 at 4:25 PM


Hi Friend,

Please visit the following link:

http://www.roseindia.net/struts/

Hope that it will be helpful for you.
Thanks


Related Tutorials/Questions & Answers:
STRUTS
STRUTS  MAIN DIFFERENCES BETWEEN STRUTS 1 AND STRUTS 2
STRUTS
STRUTS  MAIN DIFFERENCES BETWEEN STRUTS 1 AND STRUTS 2
Advertisements
Struts
Struts   How to retrive data from database by using Struts
Struts
Struts  what is SwitchAction in struts
Struts
Struts  how to learn struts
STRUTS
STRUTS   Request context in struts? SendRedirect () and forward how to configure in struts-config.xml
struts
struts  in industry, struts 1 and struts 2. which is the best? which is useful as a professuional   Have a look at the following link: Struts Tutorials
struts
struts shopping cart project in struts with oracle database connection  shopping cart project in struts with oracle database connection   Have a look at the following link: Struts Shopping Cart using MySQL
struts
struts  what are the 4 methods of struts framework
Struts
Struts  Tell me good struts manual
Struts
Struts   When Submit a Form and while submit is working ,press the Refresh , what will happen in Struts
struts
struts  Hi what is struts flow of 1.2 version struts? i have struts applicatin then from jsp page how struts application flows Thanks Kalins Naik   Please visit the following link: Struts Tutorial
struts
struts  i have no any idea about struts.please tell me briefly about struts?**   Hi Friend, You can learn struts from the given link: Struts Tutorials Thanks
struts
struts  why doc type is not manditory in struts configuration file
struts
struts  why doc type is not manditory in struts configuration file
struts
struts  why doc type is not manditory in struts configuration file
struts
struts  why doc type is not manditory in struts configuration file
struts
struts   how to write Dao to select data from the database
Struts
Struts   What is called properties file in struts? How you call the properties message to the View (Front End) JSP Pages
Struts
Struts   in struts I want two struts.xml files. Where u can specify that xml files location and which tag u specified
Struts
Setter methods of form bean class in Struts applications  who calls the setter methods of form bean class in struts applications
struts
struts   Hi how struts flows from jsp page to databae and also using validation ? Thanks Kalins Naik
Struts
Struts  Hi i am new to struts. I don't know how to create struts please in eclipse help me
Struts
Struts  How Struts is useful in application development? Where to learn Struts? Thanks   Hi, Struts is very useful in writing web... performance Java web applications that runs on Java enabled application servers. Struts
struts
struts  which is the best book to study struts on own? please tell me   You can learn struts through the following books: 1)Programming Jakarta Struts By Chuck Cavaness 2)Professional Jakarta Struts By James Goodwill
struts
struts  which is the best book to study struts on own? please tell me   You can learn struts through the following books: 1)Programming Jakarta Struts By Chuck Cavaness 2)Professional Jakarta Struts By James Goodwill
struts
struts  how to start struts?   Hello Friend, Please visit the following links: http://www.roseindia.net/struts/ http://www.roseindia.net... can easily learn the struts. Thanks
Struts
Struts   1)in struts server side validations u are using programmatically validations and declarative validations? tell me which one is better ? 2) How to enable the validator plug-in file
Struts
Struts  Am newly developed struts applipcation,I want to know how to logout the page using the strus   Please visit the following link: Struts Login Logout Application
struts
struts  hi i would like to have a ready example of struts using "action class,DAO,and services" for understanding.so please guide for the same. thanks  Please visit the following link: Struts Tutorials
Struts - Struts
Struts for beginners  struts for beginners example
Advertisements
 

 

 

DMCA.com