Struts
=========================
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>
View Answers
March 31, 2010 at 4:25 PM
Related Tutorials/Questions & Answers:
Struts Struts How to retrive data from database by using
Struts STRUTSSTRUTS MAIN DIFFERENCES BETWEEN
STRUTS 1 AND
STRUTS 2
Advertisements
STRUTSSTRUTS MAIN DIFFERENCES BETWEEN
STRUTS 1 AND
STRUTS 2
StrutsStruts what is SwitchAction in
struts StrutsStruts how to learn
struts STRUTS STRUTS Request context in
struts?
SendRedirect () and forward how to configure in
struts-config.xml
strutsstruts 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
StrutsStruts Tell me good
struts manual
strutsstruts what are the 4 methods of
struts framework
strutsstruts 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 When Submit a Form and while submit is working ,press the Refresh , what will happen in
Struts strutsstruts 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 how to write Dao to select data from the database
strutsstruts why doc type is not manditory in
struts configuration file
strutsstruts why doc type is not manditory in
struts configuration file
strutsstruts why doc type is not manditory in
struts configuration file
strutsstruts why doc type is not manditory in
struts configuration file
StrutsSetter methods of form bean class in
Struts applications who calls the setter methods of form bean class in
struts applications
Struts Struts What is called properties file in
struts? How you call the properties message to the View (Front End) JSP Pages
StrutsStruts Hi i am new to
struts. I don't know how to create
struts please in eclipse help me
struts struts Hi
how
struts flows from jsp page to databae and also using validation ?
Thanks
Kalins Naik
Struts Struts in
struts I want two struts.xml files. Where u can specify that xml files location and which tag u specified
strutsstruts 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
strutsstruts 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
StrutsStruts 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 strutsstruts how to start
struts?
Hello Friend,
Please visit the following links:ADS_TO_REPLACE_1
http://www.roseindia.net/
struts/
http... through which you can easily learn the
struts.
ThanksADS_TO_REPLACE_2
strutsstruts i have no any idea about struts.please tell me briefly about
struts?**
Hi Friend,
You can learn
struts from the given link:ADS_TO_REPLACE_1
Struts Tutorials
Thanks
strutsstruts 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
StrutsStruts 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 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
strutsstruts please send me a program that clearly shows the use of
struts with jsp
strutsstruts Hi,
1) can we write two controller classes in
struts strutsstruts Hi,... please help me out how to store image in database(mysql) using
struts strutsstruts how to generate bar code for continuous numbers in a loop using
struts ... or atleast for a given number
Struts Struts How will you retrieve a collection of records from business logic to presentation logic in framework
STRUTSSTRUTS 1)Have you used
struts tag libraries in your application?
2)What are the various types of tag libraries in
struts? Elaborate each of them?
3)How can you implement custom tag libraries in your application
strutsstruts hi
i would like to have a ready example of
struts using"action class,DAO,and services"
so please help me
strutsstruts Hi,
Here my quation is
can i have more than one validation-rules.xml files in a
struts application
strutsstruts we have the concept of jsp's and servlets right we can develop the web-pages each and everything then why what for
struts inturdouced
STRUTS STRUTS 1) Difference between Action form and DynaActionForm?
2) How the Client request was mapped to the Action file? Write the code and explain
STRUTS STRUTS Validation: user entered as 123.34567
I want the value as 123.34 once the user submits. How you will validate
struts technologies like servlets, jsp,and
struts.
i am doing one
struts application where i... the following links:
http://www.roseindia.net/
struts/StrutsCustomValidator.shtml
http://www.roseindia.net/
struts/addressstrutsvalidator.shtml
http
StrutsStruts What is
Struts?
Hi hriends,
Struts is a web page... web applications quickly and easily.
Struts combines Java Servlets, Java Server...,
Struts is a web page development framework and an open source software that helps
struts struts i have one textbox for date field.when i selected date from datecalendar then the corresponding date will appear in textbox.i want code for this in struts.plz help me
Struts - StrutsStruts examples for beginners
Struts tutorial and examples for beginners
StrutsStruts why in
Struts ActionServlet made as a singleton what is the specific reason how it useful in the webapplication development?
Basically in
Struts we have only Two types of Action classes.
1.BaseActions
StrutsStruts Why
struts rather than other frame works?
Struts is used into web based enterprise applications. Struts2 cab be used with Spring... by the application.
There are several advantages of
Struts that makes it popular
StrutsStruts I want to get the data from database into text box in a jsp page by using
struts and javascript If I click on go button it will display all the values and from that i need to select the required value and i should store