struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tesla <fatihdu...@hotmail.com>
Subject Re: Cannot find bean: sendJsp in any scope
Date Thu, 18 Mar 2010 14:29:20 GMT

alright i deleted the request.setattiribute line.  i will look at the
tutorial.really thank you for helping to me

Andrew Sharpe-2 wrote:
> 
> I found a full example for you here:
> http://www.java2s.com/Code/Java/J2EE/StrutsFrameworkASampleStrutsApplication.htm
> 
> 
> You'll notice that the name property of the logic:iterate tag is set to
> the form name as used in struts-config (in your case, BookForm).
> 
> Assuming data.jsp forwards to BookAction, you should not need to put the
> book list on the request as you are doing in the execute method of the
> BookAction.
> 
> Again I suggest you try to get a simple String property on the action form
> to display in your browser and then work your way up to the collection.
> 
> Good luck!
> 
> Andrew
> 
> 
> ----- Original Message ----
> From: tesla <fatihdurdu@hotmail.com>
> To: user@struts.apache.org
> Sent: Wed, March 17, 2010 11:10:15 AM
> Subject: Re: Cannot find bean: sendJsp in any scope
> 
> 
> I already had public getName() method.i wrote all getters and setters to
> my
> application just didn't post them to the forum.i created a new arraylist
> and
> added String property but cant show them always the same error.I'm losing
> my
> mind i have a problem with listing array elements.I really be thankful to
> you really send me a working example.i'm waiting for your reply thanks
> again
> 
> 
> Andrew Sharpe-2 wrote:
>> 
>> 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@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
>>>
>> 
>> 
>> 
>>       __________________________________________________________________
>> Looking for the perfect gift? Give the gift of Flickr! 
>> 
>> http://www.flickr.com/gift/
>> 
>> ---------------------------------------------------------------------
>> 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/Re%3A-Cannot-find-bean%3A-sendJsp-in-any-scope-tp27932975p27933365.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
> 
> 
>       __________________________________________________________________
> Be smarter than spam. See how smart SpamGuard is at giving junk email the
> boot with the All-new Yahoo! Mail.  Click on Options in Mail and switch to
> New Mail today or register for free at http://mail.yahoo.ca
> 
> ---------------------------------------------------------------------
> 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/Re%3A-Cannot-find-bean%3A-sendJsp-in-any-scope-tp27932975p27946376.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


Mime
View raw message