• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find bean TestForm in any scope'

 
Santosh Maskar
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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());
 
Ravi Seshu
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic