Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

Re: Cannot find bean: sendJsp in any scope

Andrew Sharpe

2010-03-17

Replies: Find Java Web Hosting

Author LoginPost Reply
Along with the change I suggested, you also need to add a public getName() method to your Book object. Try that, and also make sure you can get a simple String property to display to ensure you have Struts configured properly.

If you still have trouble let me know and I ll come up with a working example for you tonight.

On Wed Mar 17th, 2010 6:51 AM ADT tesla wrote:

>
>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 <fatihdurdu@(protected)>
>> To: user@(protected)
>> 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@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>     __________________________________________________________________
>> 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@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
>--
>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@(protected)
>For additional commands, e-mail: user-help@(protected)
>



   __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.