The moose likes Struts and the fly likes Cannot find bean TestForm 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 "Cannot find bean TestForm in any scope Watch "Cannot find bean TestForm in any scope New topic

Cannot find bean TestForm in any scope'

Santosh Maskar
Ranch Hand

Joined: Jul 02, 2003
Posts: 226
I am getting the following exception on my web browser when I try to access the action

[ServletException in:/jsp/displayName.jsp] Cannot find bean TestForm in any scope'

here is my struts config


<form-bean name="TestForm" type="com.src.TestForm" />

<action name="TestForm"
path="mytiles" />



<message-resources key="com.src.Management" null="false" parameter="myMessages" />


tiles config file.


<!-- Deployment Requests -->
<definition extends="myDef" name="mytiles">
<put name="body" value="/jsp/displayName.jsp" />


Can anybody tell me what is wrong in this configuration
[ April 15, 2006: Message edited by: Santosh Maskar ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Before displaying "displayName.jsp", you must instantiate a TestForm object and place it in session scope using the statement:

request.getSession().setAttribute("Testform", new TestForm());

Consultant, Sima Solutions
Ravi Seshu
Ranch Hand

Joined: Mar 19, 2005
Posts: 38

Here are few things to note while using Struts :

name of the html:form tag in jsp should have the same name as formbean and type:Testform(ur class)

that name must be the name in action tag , name of formbean...

if these coinside and if Test exists in the classpath or /web-inf/classes folder with ur structure

then it works.try with it

I agree. Here's the link:
subject: Cannot find bean TestForm in any scope'
It's not a secret anymore!