File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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

<struts-config>

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


<action-mappings>
<action name="TestForm"
path="/myAction"
type="com.src.mytAction"
scope="session"
validate="false"
input="mytiles">
path="mytiles" />

</action>


</action-mappings>

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

</struts-config>

tiles config file.

<tiles-definitions>

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

</tiles-definitions>

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());


Merrill
Consultant, Sima Solutions
Ravi Seshu
Ranch Hand

Joined: Mar 19, 2005
Posts: 38
hi,

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 Testform.java class)

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

if these coinside and if Test form.java exists in the classpath or /web-inf/classes folder with ur structure
/com/src/../urclass.java

then it works.try with it

-eswar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot find bean TestForm in any scope'