Hi,
in action-mappings there is no result defined for your action,
is it on purpose?
Best greetings,
Paweł Wielgus.
2010/3/10 tesla <fatihdurdu@(protected)>:
>
> from a few days i'm working on struts and i'm trying to develop an simple web
> application.
> i cant see the elements of my array(bookList) on jsp page when i run my
> program it returns me an empty page where am i wrong please help me i'm
> losing my mind for two days.
>
>
> Book class
>
> 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;
> }
>
> BookForm Class
>
> public class BookForm extends
org.apache.struts.action.ActionForm {
>
> private ArrayList<Book> bookList;
>
> private String name;
>
> private int number;
>
> public ArrayList<Book> getBookList() {
> return bookList;
> }
>
> public void setBookList(ArrayList<Book> bookList) {
> this.bookList = bookList;
> }
>
> BookAction Class
>
> public class BookAction extends
org.apache.struts.action.Action {
>
> private final static String SUCCESS = "success";
>
> 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());
>
>
> return mapping.findForward(SUCCESS);
> }
> }
>
> struts_config.xml
>
> <form-beans>
> <form-bean name="BookForm" type="paket.BookForm"/>
> </form-beans>
>
> <action-mappings>
> <action input="/data" name="BookForm" path="/data" scope="request"
> type="paket.BookAction"/>
> </action-mappings>
>
> data.jsp
>
> <logic:present name="BookForm">
> <logic:iterate name="BookForm" property="bookList" id="book">
> <tr>
> <td><bean:write name="book" property="name" /></td>
> </tr>
> </logic:iterate>
> </logic:present>
> --
> View this message in context: http://old.nabble.com/basic-struts-application-tp27844692p27844692.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)
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)