You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by tesla <fa...@hotmail.com> on 2010/03/16 11:00:26 UTC

Cannot find bean: "sendJsp" in any scope

Hi
I wanna show my arrayList on the screen by using logic:iterate tag but when
i run my application i am gettig this error.I'm working on this application
for two days and still i cant see my arraylist elements on the browser.
Thanks in advice.

 data.jsp

<logic:iterate id="book" name="sendJsp"   property="bookList">
    <bean:write name="book" property="name"/>
  </logic:iterate>

Book.java

public class Book {
    
    private String name;
    private String description;
    private int price;
    private int id;

    public Book()
   {
       
   }
    public Book(String name)
    {
        this.name=name;
    }

     public ArrayList<Book> loadData()
     {
         ArrayList<Book> kitapListesi = new ArrayList<Book>();
         kitapListesi.add(new Book("calculus1"));
          kitapListesi.add(new Book("calculus2"));
         return kitapListesi;
     }

BookAction.java

  public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

    
        BookForm bookForm = (BookForm) form;
        Book book = new Book();
        bookForm.setBookList(book.loadData());
       request.setAttribute("sendJsp", bookForm.getBookList());
        return mapping.findForward(SUCCESS);
    }

BookForm.Java

public class BookForm extends org.apache.struts.action.ActionForm {
    
 private ArrayList<Book> bookList = new ArrayList<Book>();

    public BookForm() {
        super();
        // TODO Auto-generated constructor stub
    }
    public ArrayList<Book> getBookList() {  return bookList; }
  public void setBookList(ArrayList<Book> bookList) {  this.bookList =
bookList; }

struts_config.xml

<form-bean name="BookForm" type="paket.BookForm"></form-bean>>

 <action input="/data.jsp" name="BookForm" path="/data" scope="request"
type="paket.BookAction" >
  </action>
  
-- 
View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22sendJsp%22-in-any-scope-tp27915481p27915481.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


Re: Cannot find bean: "sendJsp" in any scope

Posted by tesla <fa...@hotmail.com>.
thanks for reply but it still doesn't work.I am looking the tutorials on the
google and it  must be like this but its not working .I cant understand why
it is?if you have an example with arrays and logic iterate i will be
thankful if you share it with me

Andrew Sharpe-2 wrote:
> 
> I think you want:
> 
> <logic:iterate id="book" name="BookForm" property="bookList">
>      <bean:write name="book" property="name"/>
> </logic:iterate>
> 
> See the docs on logic:iterate for more info:
> http://struts.apache.org/1.0.2/struts-logic.html#iterate
> 
> If this still doesn't work I would recommend trying to first output a
> String property to verify you have everything setup properly.
> 
> 
> 
> ----- Original Message ----
> From: tesla <fa...@hotmail.com>
> To: user@struts.apache.org
> Sent: Tue, March 16, 2010 10:24:13 AM
> Subject: Re: Cannot find bean: "sendJsp" in any scope
> 
> 
> When i add logic present tag to data.jsp i am not getting an error but my
> page is still empty i think my arraylist is null but why? i'm waiting your
> advices
> 
> tesla wrote:
>> 
>> Hi
>> I wanna show my arrayList on the screen by using logic:iterate tag but
>> when i run my application i am gettig this error.I'm working on this
>> application for two days and still i cant see my arraylist elements on
>> the
>> browser.
>> Thanks in advice.
>> 
>>  data.jsp
>> 
>> <logic:iterate id="book" name="sendJsp"   property="bookList">
>>     <bean:write name="book" property="name"/>
>>   </logic:iterate>
>> 
>> Book.java
>> 
>> public class Book {
>>    
>>     private String name;
>>     private String description;
>>     private int price;
>>     private int id;
>> 
>>     public Book()
>>    {
>>        
>>    }
>>     public Book(String name)
>>     {
>>         this.name=name;
>>     }
>> 
>>      public ArrayList<Book> loadData()
>>      {
>>          ArrayList<Book> kitapListesi = new ArrayList<Book>();
>>          kitapListesi.add(new Book("calculus1"));
>>           kitapListesi.add(new Book("calculus2"));
>>          return kitapListesi;
>>      }
>> 
>> BookAction.java
>> 
>>   public ActionForward execute(ActionMapping mapping, ActionForm form,
>>             HttpServletRequest request, HttpServletResponse response)
>>             throws Exception {
>> 
>>    
>>         BookForm bookForm = (BookForm) form;
>>         Book book = new Book();
>>         bookForm.setBookList(book.loadData());
>>        request.setAttribute("sendJsp", bookForm.getBookList());
>>         return mapping.findForward(SUCCESS);
>>     }
>> 
>> BookForm.Java
>> 
>> public class BookForm extends org.apache.struts.action.ActionForm {
>>    
>>  private ArrayList<Book> bookList = new ArrayList<Book>();
>> 
>>     public BookForm() {
>>         super();
>>         // TODO Auto-generated constructor stub
>>     }
>>     public ArrayList<Book> getBookList() {  return bookList; }
>>   public void setBookList(ArrayList<Book> bookList) {  this.bookList =
>> bookList; }
>> 
>> struts_config.xml
>> 
>> <form-bean name="BookForm" type="paket.BookForm"></form-bean>>
>> 
>>  <action input="/data.jsp" name="BookForm" path="/data" scope="request"
>> type="paket.BookAction" >
>>   </action>
>>  
>> 
> 
> -- 
> View this message in context:
> http://old.nabble.com/Cannot-find-bean%3A-%22sendJsp%22-in-any-scope-tp27915481p27918564.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
> 
> 
>       __________________________________________________________________
> Connect with friends from any web browser - no download required. Try the
> new Yahoo! Canada Messenger for the Web BETA at
> http://ca.messenger.yahoo.com/webmessengerpromo.php
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22sendJsp%22-in-any-scope-tp27915481p27929687.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


Re: Cannot find bean: "sendJsp" in any scope

Posted by Andrew Sharpe <an...@yahoo.com>.
I think you want:

<logic:iterate id="book" name="BookForm" property="bookList">
     <bean:write name="book" property="name"/>
</logic:iterate>

See the docs on logic:iterate for more info: http://struts.apache.org/1.0.2/struts-logic.html#iterate

If this still doesn't work I would recommend trying to first output a String property to verify you have everything setup properly.



----- Original Message ----
From: tesla <fa...@hotmail.com>
To: user@struts.apache.org
Sent: Tue, March 16, 2010 10:24:13 AM
Subject: Re: Cannot find bean: "sendJsp" in any scope


When i add logic present tag to data.jsp i am not getting an error but my
page is still empty i think my arraylist is null but why? i'm waiting your
advices

tesla wrote:
> 
> Hi
> I wanna show my arrayList on the screen by using logic:iterate tag but
> when i run my application i am gettig this error.I'm working on this
> application for two days and still i cant see my arraylist elements on the
> browser.
> Thanks in advice.
> 
>  data.jsp
> 
> <logic:iterate id="book" name="sendJsp"   property="bookList">
>     <bean:write name="book" property="name"/>
>   </logic:iterate>
> 
> Book.java
> 
> public class Book {
>    
>     private String name;
>     private String description;
>     private int price;
>     private int id;
> 
>     public Book()
>    {
>        
>    }
>     public Book(String name)
>     {
>         this.name=name;
>     }
> 
>      public ArrayList<Book> loadData()
>      {
>          ArrayList<Book> kitapListesi = new ArrayList<Book>();
>          kitapListesi.add(new Book("calculus1"));
>           kitapListesi.add(new Book("calculus2"));
>          return kitapListesi;
>      }
> 
> BookAction.java
> 
>   public ActionForward execute(ActionMapping mapping, ActionForm form,
>             HttpServletRequest request, HttpServletResponse response)
>             throws Exception {
> 
>    
>         BookForm bookForm = (BookForm) form;
>         Book book = new Book();
>         bookForm.setBookList(book.loadData());
>        request.setAttribute("sendJsp", bookForm.getBookList());
>         return mapping.findForward(SUCCESS);
>     }
> 
> BookForm.Java
> 
> public class BookForm extends org.apache.struts.action.ActionForm {
>    
>  private ArrayList<Book> bookList = new ArrayList<Book>();
> 
>     public BookForm() {
>         super();
>         // TODO Auto-generated constructor stub
>     }
>     public ArrayList<Book> getBookList() {  return bookList; }
>   public void setBookList(ArrayList<Book> bookList) {  this.bookList =
> bookList; }
> 
> struts_config.xml
> 
> <form-bean name="BookForm" type="paket.BookForm"></form-bean>>
> 
>  <action input="/data.jsp" name="BookForm" path="/data" scope="request"
> type="paket.BookAction" >
>   </action>
>  
> 

-- 
View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22sendJsp%22-in-any-scope-tp27915481p27918564.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


      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Cannot find bean: "sendJsp" in any scope

Posted by tesla <fa...@hotmail.com>.
When i add logic present tag to data.jsp i am not getting an error but my
page is still empty i think my arraylist is null but why? i'm waiting your
advices

tesla wrote:
> 
> Hi
> I wanna show my arrayList on the screen by using logic:iterate tag but
> when i run my application i am gettig this error.I'm working on this
> application for two days and still i cant see my arraylist elements on the
> browser.
> Thanks in advice.
> 
>  data.jsp
> 
> <logic:iterate id="book" name="sendJsp"   property="bookList">
>     <bean:write name="book" property="name"/>
>   </logic:iterate>
> 
> Book.java
> 
> public class Book {
>     
>     private String name;
>     private String description;
>     private int price;
>     private int id;
> 
>     public Book()
>    {
>        
>    }
>     public Book(String name)
>     {
>         this.name=name;
>     }
> 
>      public ArrayList<Book> loadData()
>      {
>          ArrayList<Book> kitapListesi = new ArrayList<Book>();
>          kitapListesi.add(new Book("calculus1"));
>           kitapListesi.add(new Book("calculus2"));
>          return kitapListesi;
>      }
> 
> BookAction.java
> 
>   public ActionForward execute(ActionMapping mapping, ActionForm form,
>             HttpServletRequest request, HttpServletResponse response)
>             throws Exception {
> 
>     
>         BookForm bookForm = (BookForm) form;
>         Book book = new Book();
>         bookForm.setBookList(book.loadData());
>        request.setAttribute("sendJsp", bookForm.getBookList());
>         return mapping.findForward(SUCCESS);
>     }
> 
> BookForm.Java
> 
> public class BookForm extends org.apache.struts.action.ActionForm {
>     
>  private ArrayList<Book> bookList = new ArrayList<Book>();
> 
>     public BookForm() {
>         super();
>         // TODO Auto-generated constructor stub
>     }
>     public ArrayList<Book> getBookList() {  return bookList; }
>   public void setBookList(ArrayList<Book> bookList) {  this.bookList =
> bookList; }
> 
> struts_config.xml
> 
> <form-bean name="BookForm" type="paket.BookForm"></form-bean>>
> 
>  <action input="/data.jsp" name="BookForm" path="/data" scope="request"
> type="paket.BookAction" >
>   </action>
>   
> 

-- 
View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22sendJsp%22-in-any-scope-tp27915481p27918564.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