File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes javax.servlet.jsp.JspException: Cannot find bean under name jobtitleList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javax.servlet.jsp.JspException: Cannot find bean under name jobtitleList" Watch "javax.servlet.jsp.JspException: Cannot find bean under name jobtitleList" New topic

javax.servlet.jsp.JspException: Cannot find bean under name jobtitleList

debanjana chakraborty

Joined: Mar 08, 2010
Posts: 3
i have an struts error and stuck with it. I am sending the whole program.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@ taglib uri="/WEB-INF/app.tld" prefix="app"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ page import="java.util.*" %>
<%List list=(List)request.getAttribute("jobtitleList");
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<link href="css/style.css" rel="stylesheet" type="text/css">
<title>search page</title>
<body bgcolor="F5E4C7" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0" onLoad="cursor();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td bgcolor="0A50A1"><img src="images/title.gif" width="376"
<td valign="top" class="bodyTextBold"><img
src="images/spacer.gif" width="17"><br>
<html:form action="/searchGo">
<table cellspacing=0 cellpadding=0 width=250 border=0>
<td rowspan="3"><img src="images/spacer.gif" width="19"></td>
<td width=11><img height=11
src="images/rounded_box_r1_c1.gif" width=11></td>
<td width=235 background="images/rounded_box_r1_c2.gif"><img
src="images/transparent.gif" width="1" height="1"></td>
<td width=11><img height=11
src="images/rounded_box_r1_c4.gif" width=11></td>
<td class=text background="images/rounded_box_r2_c1.gif"> </td>
<td valign="top" class=bodyText>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td colspan="3"><img src="images/label.gif" width="300"
<td colspan="3"><img src="images/small-label.gif"></td>
<tr class="bodyTextBold">
<td align="right" nowrap><bean:message key="prompt.jobtitle" /></td>
<td nowrap> </td>
<td nowrap><html:select styleClass="bodyText" property="jobtitles" multiple="true" size="5">
<htmlption value="0">Select jobtitle</htmlption>
<htmlptions collection="jobtitleList" property="value" labelProperty="label"/>
<td background="images/rounded_box_r2_c5.gif"> </td>
<td valign="top"><img height=11
src="images/rounded_box_r4_c1.gif" width=11></td>
<td align=right background="images/rounded_box_r4_c2.gif"
class="SMALL"> </td>
<td valign="top"><img height=11
src="images/rounded_box_r4_c4.gif" width=11></td>
package employeelocator.domain;

import org.apache.struts.action.ActionForm;

import com.ConnectionFactory;

public class SearchForm extends ActionForm {
private String[] jobtitles = null;

public String[] getJobtitles() {
return jobtitles;

public void setJobtitles(String[] jobtitles) {
this.jobtitles = jobtitles;


SearchAction that extends BaseAction(My action class)
package employeelocator.action;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.util.LabelValueBean;

import com.ConnectionFactory;

public class BaseAction extends Action {
public static void setEmployeeDropDownList(HttpServletRequest request) {
// get new modifiable data List
List<LabelValueBean> jobtitlelist = new ArrayList<LabelValueBean>();
String query1 = "select jobtitle from my_employeeloc";

try {
Connection conn = null;
ResultSet rs = null;
Statement st = null;
conn = ConnectionFactory.getConnection();
st = conn.createStatement();
rs = st.getResultSet();
System.out.println("Before rs");
while ( {
System.out.println("Before label Value Bean");
LabelValueBean lvb1 = new LabelValueBean(rs
.getString("jobtitle"), rs.getString("jobtitle"));

} catch (Exception ee) {
request.setAttribute("jobtitleList", jobtitlelist);


package employeelocator.action;

import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.*;

import employeelocator.domain.SearchForm;

public class SearchAction extends BaseAction {
public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String[] jobtitles = null;

// get parameters
jobtitles = (String[]) request.getAttribute("jobtitleList");
SearchForm dataform = (SearchForm) form;
return (mapping.findForward("search"));

Prashant Langade
Ranch Hand

Joined: Jul 01, 2009
Posts: 73

It would be good if you would had placed your code int code tags

Its really difficult to understand the problem.

I agree. Here's the link:
subject: javax.servlet.jsp.JspException: Cannot find bean under name jobtitleList
It's not a secret anymore!