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 bean:define error - Cannot find bean in scope null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:define error - Cannot find bean in scope null" Watch "bean:define error - Cannot find bean in scope null" New topic
Author

bean:define error - Cannot find bean in scope null

Si Smith
Greenhorn

Joined: Apr 27, 2009
Posts: 5
Hi,

I have an action where I set an attribute in the request.

I then use a forward to get to the JSP that displays the outcome of the action.

In the JSP I can get to the attribute in the request using



However I would much rather use bean:define to get to my request attribute. Unfortunately I can't seem to find it.
If I use

the text "PRESENT!" is not output.

When I try to define the bean using



When I try to use the bean DocumentList, I get the error that the bean documentList cannot be found in scope null

What am I doing wrong for the documentList bean to not be found?

Thanks,
Simon
Si Smith
Greenhorn

Joined: Apr 27, 2009
Posts: 5
I think what is confusing me the most with this is that I am able to get to the request attribute in Java but when I try to use struts bean:define to create a bean in the JSP using the request attribute, it doesn't seem to be able to find it.

Can anyone point me in the right direction?

Regards,
Simon
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Si Smith wrote:
the text "PRESENT!" is not output.

I don't know whether this works or not, but try using "parameter" attribute


Si Smith wrote:
When I try to define the bean using

When I try to use the bean DocumentList, I get the error that the bean documentList cannot be found in scope null
What am I doing wrong for the documentList bean to not be found?

<bean:define.../> is mainly used if you want to define a bean for a given scope, but from your example I don't think that its bean, its an instance of "List" class. So to make an individual bean from this "list" object, you need to iterate over this list, something like this



[Please check the basic "attributes" for "iterate" & "write" tags from Struts sites.]


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 365
are you forwarding to JSP directly OR using tiles of struts framework?


Thanks,
Shailesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: bean:define error - Cannot find bean in scope null
 
Similar Threads
Cannot find bean "" in scope request
problem with html:errors
Cannot find bean: "AssetDefinitoinForm" in scope: "request"
javax.servlet.ServletException: Cannot find bean employerSearchForm in any scope
bean:define , null checks and logic:present