Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

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

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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">
<html:option value="0">Select jobtitle</html:option>
<html:options 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"));

Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

Its really difficult to understand the problem.

Do Re Mi Fa So La Tiny Ad
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic