File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes  Cannot find bean: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark " Cannot find bean: " in any scope" Watch " Cannot find bean: " in any scope" New topic

Cannot find bean: " in any scope

Ranch Hand

Joined: Sep 19, 2006
Posts: 49
i got following error

javax.servlet.ServletException: Cannot find bean: "displaySharesToFundForm" in any scope

and my action class is

public class DisplaySharesToFundAction extends AbstractBaseAction{

public ActionForward process(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Throwable{
DisplaySharesToFundForm displaySharesToFundForm = (DisplaySharesToFundForm)form;
SharesToFundValidationHelper sharesToFundValidationHelper = new SharesToFundValidationHelper();
HttpSession session = request.getSession(false);

ArrayList shareTypeList = (ArrayList)TypeCodeTableHelper.getInstance().getTypeCodeList(KMSConstants.SHARE_TYPE);;

ArrayList currencyList = (ArrayList)TypeCodeTableHelper.getInstance().getTypeCodeList(KMSConstants.BASE_CURRENCY);;

session.setAttribute("CurrencyList",displaySharesToFundForm .getCurrencyList());
session.setAttribute("ShareTypeList",displaySharesToFundForm .getShareTypeList());

return null;

please help

thanks in advance
sridhar ravi

Joined: Aug 24, 2006
Posts: 3

Check whether displaySharesToFundForm this name is matched with struts-config.xml entry i both

<form-bean> and <action-mapping>

if it is ok then check in jsp

<form > tag whether name is mentioned and type is pointing to the form name path.

Thank & Regards
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This message is being thrown by Struts as it's trying to process your JSP. It's saying you've referred to a bean named displaySharesToFundForm that doesn't exist. Struts will only instantiate the bean associated with the action. So, if you have an html:form tag with action="myAction", when you define the mapping for "myAction", you must specify "displaySharesToFundForm" as the name associated with that action.

If you still can't find the problem, show us your JSP, and the relevant portions of your struts-config.xml file. Showing us the code in your Action class doesn't help.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Cannot find bean: " in any scope
It's not a secret anymore!