Quantcast

Cannot find bean in any scope

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cannot find bean in any scope

gbattine
Hello guys,
I'm newbie of Struts, please help me.
I've an action that calls some business logic, retrieve a a list and set it into request, calling later a jsp, in which I try to show this list through iterate tag.

this is jsp to show list

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
       

Ricerca film

            <logic:iterate id="dvds" name="dvds" type="bean.DVD">
       
                                         
               
    </logic:iterate>

this is action that pass to list a list of dvds
Collection c = new ArrayList();
        try {
            c = manager.getAll();
                    } catch (DAOException e) {
            String message = "DVDs could not be listed";
            errors.add("label", new ActionError("error.listfailed"));
            saveErrors(request, errors);
            return (mapping.findForward("error"));


        }
session.setAttribute("dvds", c);


besides dvd (shown in jsp) is a bean to show each item of dvds list.
Instead of show jsp with list of dvd I've this error:

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "DVD" in any scope

How can I solve it?
please help me,
Thanks

TitoloRegiaSceneggiatura
<bean:write name="DVD" property="titolo"/><bean:write name="DVD" property="regia"/><bean:write name="DVD" property="sceneggiatura"/>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot find bean in any scope

Nils-Helge Garli
From the taglib reference for "iterate" [1]:

id - The name of a page scope JSP bean that will contain the current
element of the collection on each iteration, if it is not null.

In your example, you have used id="dvds" which means that you would
have to use <bean:write name="dvds" .... instead of name="DVD".

Nils-H

[1] - http://struts.apache.org/1.3.8/struts-taglib/tagreference.html#logic:iterate

On Sun, Dec 7, 2008 at 5:39 PM, gbattine <[hidden email]> wrote:

>
> Hello guys,
> I'm newbie of Struts, please help me.
> I've an action that calls some business logic, retrieve a a list and set it
> into request, calling later a jsp, in which I try to show this list through
> iterate tag.
>
> this is jsp to show list
>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> <html>
>    <head>
>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>        <title>JSP Page</title>
>    </head>
>    <body>
>        <h2>Ricerca film</h2>
>        <table border="1">
> <thead>
> <tr>
> <th>Titolo</th>
> <th>Regia</th>
> <th>Sceneggiatura</th>
> </tr>
> </thead>
> <tbody>
>    <logic:iterate id="dvds" name="dvds" type="bean.DVD">
>
>     <tr>
>         <td><bean:write name="DVD" property="titolo"/></td>
>         <td><bean:write name="DVD" property="regia"/></td>
>         <td><bean:write name="DVD" property="sceneggiatura"/></td>
>
>    </tr>
>
>    </logic:iterate>
>
> this is action that pass to list a list of dvds
> Collection c = new ArrayList();
>        try {
>            c = manager.getAll();
>                    } catch (DAOException e) {
>            String message = "DVDs could not be listed";
>            errors.add("label", new ActionError("error.listfailed"));
>            saveErrors(request, errors);
>            return (mapping.findForward("error"));
>
>
>        }
> session.setAttribute("dvds", c);
>
>
> besides dvd (shown in jsp) is a bean to show each item of dvds list.
> Instead of show jsp with list of dvd I've this error:
>
> javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find
> bean: "DVD" in any scope
>
> How can I solve it?
> please help me,
> Thanks
>
>
> --
> View this message in context: http://www.nabble.com/Cannot-find-bean-in-any-scope-tp20882790p20882790.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot find bean in any scope

                                   </logic:iterate>

but I still have:

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "DVD" in any scope

I'm missing something?
Thanks




Nils-Helge Garli wrote
From the taglib reference for "iterate" [1]:

id - The name of a page scope JSP bean that will contain the current
element of the collection on each iteration, if it is not null.

In your example, you have used id="dvds" which means that you would
have to use <bean:write name="dvds" .... instead of name="DVD".

Nils-H

[1] - http://struts.apache.org/1.3.8/struts-taglib/tagreference.html#logic:iterate

On Sun, Dec 7, 2008 at 5:39 PM, gbattine <gbattine@alice.it> wrote:
>
> Hello guys,
> I'm newbie of Struts, please help me.
> I've an action that calls some business logic, retrieve a a list and set it
> into request, calling later a jsp, in which I try to show this list through
> iterate tag.
>
> this is jsp to show list
>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> <html>
>    <head>
>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>        <title>JSP Page</title>
>    </head>
>    <body>
>        

Ricerca film

>        
gbattine
Hi,
thanks very much for your help.
I understood your explanation but I didn't solve.
Now I did:

<logic:iterate id="DVD" name="dvds" type="bean.DVD">
   
<bean:write name="DVD" property="titolo"/><bean:write name="DVD" property="regia"/><bean:write name="DVD" property="sceneggiatura"/>
> > > > > > > > >    <logic:iterate id="dvds" name="dvds" type="bean.DVD">
>
>     >         >         >         >
>    >
>    </logic:iterate>
>
> this is action that pass to list a list of dvds
> Collection c = new ArrayList();
>        try {
>            c = manager.getAll();
>                    } catch (DAOException e) {
>            String message = "DVDs could not be listed";
>            errors.add("label", new ActionError("error.listfailed"));
>            saveErrors(request, errors);
>            return (mapping.findForward("error"));
>
>
>        }
> session.setAttribute("dvds", c);
>
>
> besides dvd (shown in jsp) is a bean to show each item of dvds list.
> Instead of show jsp with list of dvd I've this error:
>
> javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find
> bean: "DVD" in any scope
>
> How can I solve it?
> please help me,
> Thanks
>
>
> --
> View this message in context: http://www.nabble.com/Cannot-find-bean-in-any-scope-tp20882790p20882790.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
TitoloRegiaSceneggiatura
<bean:write name="DVD" property="titolo"/><bean:write name="DVD" property="regia"/><bean:write name="DVD" property="sceneggiatura"/>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot find bean in any scope

Nils-Helge Garli
Do you have any null values in your collection? The only way I could
reproduce something similar was if I added "null" to the collection.

Nils-H

On Mon, Dec 8, 2008 at 11:43 AM, gbattine <[hidden email]> wrote:

>
> Hi,
> thanks very much for your help.
> I understood your explanation but I didn't solve.
> Now I did:
>
> <logic:iterate id="DVD" name="dvds" type="bean.DVD">
>    <tr>
>         <td><bean:write name="DVD" property="titolo"/></td>
>         <td><bean:write name="DVD" property="regia"/></td>
>         <td><bean:write name="DVD" property="sceneggiatura"/></td>
>    </tr>
> </logic:iterate>
>
> but I still have:
>
> javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find
> bean: "DVD" in any scope
>
> I'm missing something?
> Thanks
>
>
>
>
>
> Nils-Helge Garli wrote:
>>
>> From the taglib reference for "iterate" [1]:
>>
>> id - The name of a page scope JSP bean that will contain the current
>> element of the collection on each iteration, if it is not null.
>>
>> In your example, you have used id="dvds" which means that you would
>> have to use <bean:write name="dvds" .... instead of name="DVD".
>>
>> Nils-H
>>
>> [1] -
>> http://struts.apache.org/1.3.8/struts-taglib/tagreference.html#logic:iterate
>>
>> On Sun, Dec 7, 2008 at 5:39 PM, gbattine <[hidden email]> wrote:
>>>
>>> Hello guys,
>>> I'm newbie of Struts, please help me.
>>> I've an action that calls some business logic, retrieve a a list and set
>>> it
>>> into request, calling later a jsp, in which I try to show this list
>>> through
>>> iterate tag.
>>>
>>> this is jsp to show list
>>>
>>> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
>>> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
>>> <html>
>>>    <head>
>>>        <meta http-equiv="Content-Type" content="text/html;
>>> charset=UTF-8">
>>>        <title>JSP Page</title>
>>>    </head>
>>>    <body>
>>>        <h2>Ricerca film</h2>
>>>        <table border="1">
>>> <thead>
>>> <tr>
>>> <th>Titolo</th>
>>> <th>Regia</th>
>>> <th>Sceneggiatura</th>
>>> </tr>
>>> </thead>
>>> <tbody>
>>>    <logic:iterate id="dvds" name="dvds" type="bean.DVD">
>>>
>>>     <tr>
>>>         <td><bean:write name="DVD" property="titolo"/></td>
>>>         <td><bean:write name="DVD" property="regia"/></td>
>>>         <td><bean:write name="DVD" property="sceneggiatura"/></td>
>>>
>>>    </tr>
>>>
>>>    </logic:iterate>
>>>
>>> this is action that pass to list a list of dvds
>>> Collection c = new ArrayList();
>>>        try {
>>>            c = manager.getAll();
>>>                    } catch (DAOException e) {
>>>            String message = "DVDs could not be listed";
>>>            errors.add("label", new ActionError("error.listfailed"));
>>>            saveErrors(request, errors);
>>>            return (mapping.findForward("error"));
>>>
>>>
>>>        }
>>> session.setAttribute("dvds", c);
>>>
>>>
>>> besides dvd (shown in jsp) is a bean to show each item of dvds list.
>>> Instead of show jsp with list of dvd I've this error:
>>>
>>> javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot
>>> find
>>> bean: "DVD" in any scope
>>>
>>> How can I solve it?
>>> please help me,
>>> Thanks
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Cannot-find-bean-in-any-scope-tp20882790p20882790.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Cannot-find-bean-in-any-scope-tp20882790p20893064.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot find bean in any scope

Dimitar Vlasev
1. Try this (I cite these tags on memory so excuse me if I'm not right
with the tag names)
<logic:present name="dvds"> The dvd list is present  </logic:present>
<logic:notPresent bean="dvds"> The dvd list is NOT present </logic:notPresent>

2. If the dvd list is not present try to set a simple string bean into
the request and include it in the page you're forwarding to
<bean:write name="simple_string"/>

Regards,
Dimitar Vlasev

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Cannot find bean in any scope

Eric J Givler
In reply to this post by gbattine
This sounds like one of the tutorials on Java Boutique.  Not to plug another site, but I really thought the tutorials on
________________________________________
From: gbattine [[hidden email]]
Sent: Sunday, December 07, 2008 11:39 AM
To: [hidden email]
Subject: Cannot find bean in any scope

Hello guys,
I'm newbie of Struts, please help me.
I've an action that calls some business logic, retrieve a a list and set it
into request, calling later a jsp, in which I try to show this list through
iterate tag.

this is jsp to show list

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h2>Ricerca film</h2>
        <table border="1">
<thead>
<tr>
<th>Titolo</th>
<th>Regia</th>
<th>Sceneggiatura</th>
</tr>
</thead>
<tbody>
    <logic:iterate id="dvds" name="dvds" type="bean.DVD">

     <tr>
         <td><bean:write name="DVD" property="titolo"/></td>
         <td><bean:write name="DVD" property="regia"/></td>
         <td><bean:write name="DVD" property="sceneggiatura"/></td>

    </tr>

    </logic:iterate>

this is action that pass to list a list of dvds
Collection c = new ArrayList();
        try {
            c = manager.getAll();
                    } catch (DAOException e) {
            String message = "DVDs could not be listed";
            errors.add("label", new ActionError("error.listfailed"));
            saveErrors(request, errors);
            return (mapping.findForward("error"));


        }
session.setAttribute("dvds", c);


besides dvd (shown in jsp) is a bean to show each item of dvds list.
Instead of show jsp with list of dvd I've this error:

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find
bean: "DVD" in any scope

How can I solve it?
please help me,
Thanks


--
View this message in context: http://www.nabble.com/Cannot-find-bean-in-any-scope-tp20882790p20882790.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Cannot find bean in any scope

Eric J Givler
Sorry about that...

I really think the tutorials on the Learntechnology site are better for learning struts.  They all come with downloadable war files.  Head on over to: http://www.learntechnology.net/content/main.jsp and check them out.

-----Original Message-----
From: Givler, Eric [mailto:[hidden email]]
Sent: Tuesday, December 09, 2008 11:03 AM
To: Struts Users Mailing List
Subject: RE: Cannot find bean in any scope


This sounds like one of the tutorials on Java Boutique.  Not to plug another site, but I really thought the tutorials on ________________________________________
From: gbattine [[hidden email]]
Sent: Sunday, December 07, 2008 11:39 AM
To: [hidden email]
Subject: Cannot find bean in any scope

Hello guys,
I'm newbie of Struts, please help me.
I've an action that calls some business logic, retrieve a a list and set it into request, calling later a jsp, in which I try to show this list through iterate tag.

this is jsp to show list

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h2>Ricerca film</h2>
        <table border="1">
<thead>
<tr>
<th>Titolo</th>
<th>Regia</th>
<th>Sceneggiatura</th>
</tr>
</thead>
<tbody>
    <logic:iterate id="dvds" name="dvds" type="bean.DVD">

     <tr>
         <td><bean:write name="DVD" property="titolo"/></td>
         <td><bean:write name="DVD" property="regia"/></td>
         <td><bean:write name="DVD" property="sceneggiatura"/></td>

    </tr>

    </logic:iterate>

this is action that pass to list a list of dvds
Collection c = new ArrayList();
        try {
            c = manager.getAll();
                    } catch (DAOException e) {
            String message = "DVDs could not be listed";
            errors.add("label", new ActionError("error.listfailed"));
            saveErrors(request, errors);
            return (mapping.findForward("error"));


        }
session.setAttribute("dvds", c);


besides dvd (shown in jsp) is a bean to show each item of dvds list. Instead of show jsp with list of dvd I've this error:

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find
bean: "DVD" in any scope

How can I solve it?
please help me,
Thanks


--
View this message in context: http://www.nabble.com/Cannot-find-bean-in-any-scope-tp20882790p20882790.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...