The moose likes Struts and the fly likes Can't find bean in any scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Can Watch "Can New topic

Can't find bean in any scope

Rahul Dhamecha

Joined: Mar 13, 2012
Posts: 8
I have a page called index.jsp that takes the username and password.
The form is submitted to a servlet that verifies the username and password. If they are valid, I use a sendRedirect to redirect the request to an action(ViewAccountDetailsAction) inside my Struts 1.3 application.

I am using the ViewAccountDetailsForm class as my ActionForm. This has been associated with the above action class in the struts-config.xml file.


import java.util.List;
import org.apache.struts.action.ActionForm;
import pojos.login.AccountDetails;
public class ViewAccountDetailsForm extends ActionForm {
private static final long serialVersionUID = 1L;
private List<AccountDetails> accountsList;

public List<AccountDetails> getAccountsList() {
return accountsList;
public void setAccountsList(List<AccountDetails> accountsList) {
this.accountsList = accountsList;
System.out.println("This is the size of accountList of ViewAccountDetailsForm "+this.accountsList.size());

ViewAccountDetailsAction.java method inside which the account details are gathered.

import interfaces.login.ViewAccountDetailsInterface;

public ActionForward viewDtls(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
//check for SessionActivity
HttpSession session = request.getSession();
ViewAccountDetailsForm viewAcctDtlForm = (ViewAccountDetailsForm) form;
ViewAccountDetailsInterface viewAccountDetails = new ViewAccountDetailsBean();
return mapping.findForward("launch");
return mapping.findForward("sessionexpired");
return mapping.findForward("sessionexpired");

launch.jsp - file on which all my account details must be displayed

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<logic:empty name="ViewAccountDetailsForm" property="accountsList">
The accountsList is empty
<logic:present name="ViewAccountDetailsForm" property="accountsList">
<%out.write("OSR: Present cleared"); %>
<table border="1px" bordercolor="blue">
<td>Account Number</td>
<td>Account Balance</td>
<logic:iterate id="accountDetail" name="ViewAccountDetailsForm" property="accountsList">
<td><bean:write name="accountDetail.accountId"/></td>
<td><bean:write name="accountDetail.accountBalance"/></td>
<%out.write("Outside write"); %>

I am getting Can't find ViewAccountDetailsForm bean in any scope

Can someone suggest a work around?
Rahul Dhamecha

Joined: Mar 13, 2012
Posts: 8
Forgot to give the entries of both the action and form bean in the struts config file.

<form-bean name="loginPage" type="form.userLogin.UserLoginForm"></form-bean>
<form-bean name="viewDetails" type="form.userLogin.ViewAccountDetailsForm"></form-bean>

<forward name="sessionexpired" path="sessionExpired.jsp"></forward>


<action path="/userLogin" type="userlogin.UserLoginValidation" name="loginPage"
validate="false" parameter="function">

<action path="/viewAccountDetails" type="userlogin.ViewAccountDetailsAction" name="viewDetails"
validate="false" parameter="function">
<forward name="launch" path="/viewAccountDetailsPage.jsp"></forward>

Rahul Dhamecha

Joined: Mar 13, 2012
Posts: 8
Also, below is the VO or DTO AccountDetails class

import java.io.Serializable;

public class AccountDetails implements Serializable{

private static final long serialVersionUID = 1L;
private String accountId;
private String accountHolderName;
private String accountType;
private String accountBalance;
public String getAccountId() {
return accountId;
public void setAccountId(String accountId) {
this.accountId = accountId;
public String getAccountHolderName() {
return accountHolderName;
public void setAccountHolderName(String accountHolderName) {
this.accountHolderName = accountHolderName;
public String getAccountType() {
return accountType;
public void setAccountType(String accountType) {
this.accountType = accountType;
public String getAccountBalance() {
return accountBalance;
public void setAccountBalance(String accountBalance) {
this.accountBalance = accountBalance;


I have made a list of objects of the above class.
I agree. Here's the link: http://aspose.com/file-tools
subject: Can't find bean in any scope
Similar Threads
Problem with logic:present tag
Struts & Hibernate Integration unable to delete values from MYSQL database
Problem in SessionManagement in Struts
Struts: No getter method for property name problem
Problem with logic:present