Re: Cannot find bean: sendJsp in any scope
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 fatihdu...@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 fatihdu...@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 ArrayListBook loadData() { ArrayListBook kitapListesi = new ArrayListBook(); 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 ArrayListBook bookList = new ArrayListBook(); public BookForm() { super(); // TODO Auto-generated constructor stub } public ArrayListBook getBookList() { return bookList; } public void setBookList(ArrayListBook 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-unsubscr
Re: Cannot find bean: sendJsp in any scope
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 fatihdu...@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 ArrayListBook loadData() { ArrayListBook kitapListesi = new ArrayListBook(); 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 ArrayListBook bookList = new ArrayListBook(); public BookForm() { super(); // TODO Auto-generated constructor stub } public ArrayListBook getBookList() { return bookList; } public void setBookList(ArrayListBook 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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
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 fatihdu...@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 ArrayListBook loadData() { ArrayListBook kitapListesi = new ArrayListBook(); 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 ArrayListBook bookList = new ArrayListBook(); public BookForm() { super(); // TODO Auto-generated constructor stub } public ArrayListBook getBookList() { return bookList; } public void setBookList(ArrayListBook 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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
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 ArrayListBook loadData() { ArrayListBook kitapListesi = new ArrayListBook(); 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 ArrayListBook bookList = new ArrayListBook(); public BookForm() { super(); // TODO Auto-generated constructor stub } public ArrayListBook getBookList() { return bookList; } public void setBookList(ArrayListBook 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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
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 ArrayListBook loadData() { ArrayListBook kitapListesi = new ArrayListBook(); 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 ArrayListBook bookList = new ArrayListBook(); public BookForm() { super(); // TODO Auto-generated constructor stub } public ArrayListBook getBookList() { return bookList; } public void setBookList(ArrayListBook 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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: page redirecting problem
thanks for reply. BookAdd.jsp is defined as input for bookAdd action. is it wrong??i think it must be like that. when i click submit button at the bookAdd.jsp i wanna forward to the data jsp but it dont there is no action i'm still at the bookAdd.jsp where i am wrong action input=/bookAdd.jsp name=BookAddForm path=/bookAdd scope=request type=paket.BookAddAction forward name=success path=/data.jsp/ /action Paweł Wielgus wrote: Hi Tesla, validation problem? BookAdd.jsp is defined as input for bookAdd action. Best greetings, Pawel Wielgus. 2010/3/13, tesla fatihdu...@hotmail.com: Hi I have a basic struts project i can't redirect my jsp page to another.But i did the similar example before that it was working but know it's not. My problem is bookAdd.jsp dont redirect to the data.jsp it's redirecting to the bookAdd.do please help!Thanks Here is my BookAddForm public class BookAddForm extends org.apache.struts.action.ActionForm { private String book_title; private String book_description; private int book_price; //Getters Setter public void reset(ActionMapping mapping,HttpServletRequest request){ this.book_description=null; this.book_title=null; this.book_price=0; } BookAddAction public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BookAddForm bookAddForm= (BookAddForm) form; Book book=new Book(); book.addBook(bookAddForm.getBook_title(),bookAddForm.getBook_description(),bookAddForm.getBook_price()); return mapping.findForward(SUCCESS); } Book.Java public class Book { private String title; private String description; private int price; Connection con ; Statement ps; ResultSet rs; public void addBook(String title,String description,int price) throws SQLException { try { Class.forName(com.mysql.jdbc.Driver); con = (Connection) DriverManager.getConnection(jdbc:mysql://localhost:3306/logintest_development,root,pass); ps = (Statement) con.createStatement(); String sql = insert into books(title,description,price) values('+title+','+description+''+price+'); ps.executeUpdate(sql); } catch (Exception e) { System.out.println(Error Data : + e.getMessage()); } con.close(); } bookAdd.jsp body h1Add Book!/h1 html:form action=/bookAdd method=post Book's Title:html:text property=book_title size=30 maxlength=30/br Book's Descripton:html:textarea property=book_description /br Book's Price:html:text property=book_price size=30 maxlength=30/br html:submitAdd/html:submit /html:form /body struts_config.xml form-bean name=BookAddForm type=paket.BookAddForm/ action input=/bookAdd.jsp name=BookAddForm path=/bookAdd scope=request type=paket.BookAddAction forward name=success path=/data.jsp/ /action when i click submit button at the jsp file it shows me the same page can't redirect to data.jsp but my browser changes bookAdd.jsp to bookAdd.do i cant understand why it is -- View this message in context: http://old.nabble.com/page-redirecting-problem-tp27886004p27886004.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://old.nabble.com/page-redirecting-problem-tp27886004p27888959.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: page redirecting problem
special thanks for your advice i found where validation fails.Now it's working fine Paweł Wielgus wrote: Hi, specifying bookAdd.jsp as input is for validation framework only, nor it is good or bad. So when You submit form on page, struts try to fire BookAddAction, but if validation fails (and it looks like it is the case) it comes back to input which is bookAdd.jsp Try to change input for something else and see if it is the case. Best greetings, Paweł Wielgus. 2010/3/13 tesla fatihdu...@hotmail.com: thanks for reply. BookAdd.jsp is defined as input for bookAdd action. is it wrong??i think it must be like that. when i click submit button at the bookAdd.jsp i wanna forward to the data jsp but it dont there is no action i'm still at the bookAdd.jsp where i am wrong action input=/bookAdd.jsp name=BookAddForm path=/bookAdd scope=request type=paket.BookAddAction forward name=success path=/data.jsp/ /action Paweł Wielgus wrote: Hi Tesla, validation problem? BookAdd.jsp is defined as input for bookAdd action. Best greetings, Pawel Wielgus. 2010/3/13, tesla fatihdu...@hotmail.com: Hi I have a basic struts project i can't redirect my jsp page to another.But i did the similar example before that it was working but know it's not. My problem is bookAdd.jsp dont redirect to the data.jsp it's redirecting to the bookAdd.do please help!Thanks Here is my BookAddForm public class BookAddForm extends org.apache.struts.action.ActionForm { private String book_title; private String book_description; private int book_price; //Getters Setter public void reset(ActionMapping mapping,HttpServletRequest request){ this.book_description=null; this.book_title=null; this.book_price=0; } BookAddAction public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BookAddForm bookAddForm= (BookAddForm) form; Book book=new Book(); book.addBook(bookAddForm.getBook_title(),bookAddForm.getBook_description(),bookAddForm.getBook_price()); return mapping.findForward(SUCCESS); } Book.Java public class Book { private String title; private String description; private int price; Connection con ; Statement ps; ResultSet rs; public void addBook(String title,String description,int price) throws SQLException { try { Class.forName(com.mysql.jdbc.Driver); con = (Connection) DriverManager.getConnection(jdbc:mysql://localhost:3306/logintest_development,root,pass); ps = (Statement) con.createStatement(); String sql = insert into books(title,description,price) values('+title+','+description+''+price+'); ps.executeUpdate(sql); } catch (Exception e) { System.out.println(Error Data : + e.getMessage()); } con.close(); } bookAdd.jsp body h1Add Book!/h1 html:form action=/bookAdd method=post Book's Title:html:text property=book_title size=30 maxlength=30/br Book's Descripton:html:textarea property=book_description /br Book's Price:html:text property=book_price size=30 maxlength=30/br html:submitAdd/html:submit /html:form /body struts_config.xml form-bean name=BookAddForm type=paket.BookAddForm/ action input=/bookAdd.jsp name=BookAddForm path=/bookAdd scope=request type=paket.BookAddAction forward name=success path=/data.jsp/ /action when i click submit button at the jsp file it shows me the same page can't redirect to data.jsp but my browser changes bookAdd.jsp to bookAdd.do i cant understand why it is -- View this message in context: http://old.nabble.com/page-redirecting-problem-tp27886004p27886004.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://old.nabble.com/page-redirecting-problem-tp27886004p27888959.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
Re: basic struts application
thanks for reply i saw this example in the website struts tutorial and there is no code in action mappings ? İ can't understand what am i write to the action mappings? Paweł Wielgus wrote: Hi, in action-mappings there is no result defined for your action, is it on purpose? Best greetings, Paweł Wielgus. 2010/3/10 tesla fatihdu...@hotmail.com: 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 ArrayListBook loadData() { ArrayListBook kitapListesi = new ArrayListBook(); kitapListesi.add(new Book(calculus1)); kitapListesi.add(new Book(calculus2)); return kitapListesi; } BookForm Class public class BookForm extends org.apache.struts.action.ActionForm { private ArrayListBook bookList; private String name; private int number; public ArrayListBook getBookList() { return bookList; } public void setBookList(ArrayListBook 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 tdbean: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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://old.nabble.com/basic-struts-application-tp27844692p27856795.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
basic struts application
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 ArrayListBook loadData() { ArrayListBook kitapListesi = new ArrayListBook(); kitapListesi.add(new Book(calculus1)); kitapListesi.add(new Book(calculus2)); return kitapListesi; } BookForm Class public class BookForm extends org.apache.struts.action.ActionForm { private ArrayListBook bookList; private String name; private int number; public ArrayListBook getBookList() { return bookList; } public void setBookList(ArrayListBook 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 tdbean: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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Cannot find bean: bookList in any scope
thx for helping but now when i run the application i see an empty page i can't see books which i retrive from my database i guess my arraylist is empty why it is?? -- View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22bookList%22-in-any-scope-tp27816517p27828192.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Cannot find bean: bookList in any scope
its struts 1 struts version 1.2.9 and also i added this code bookForm.getBookList().add(qwer) to bookAction.java but still i cant see array elemtens at the browser its my struts config.xml action-mappings action path=/Welcome forward=/welcomeStruts.jsp/ action path=/data type=paket.BookAction name=BookForm scope=request input=data.jsp forward name=success path=/data.jsp redirect=false / /action /action-mappings mgainty wrote: the short answer is you'll need to populate your arraylist for any of the elements in the list to 'show up' the long answer is you'll need to supply jsp/struts-config.xml,struts.xml and backend beans,contents of Action class and which struts version you are implementing on to be able to provide a solution for you Martin Gainty __ Verzicht und Vertraulichkeitanmerkung Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Date: Mon, 8 Mar 2010 13:51:10 -0800 From: fatihdu...@hotmail.com To: user@struts.apache.org Subject: Re: Cannot find bean: bookList in any scope thx for helping but now when i run the application i see an empty page i can't see books which i retrive from my database i guess my arraylist is empty why it is?? -- View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22bookList%22-in-any-scope-tp27816517p27828192.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Hotmail: Free, trusted and rich email service. http://clk.atdmt.com/GBL/go/201469228/direct/01/ -- View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22bookList%22-in-any-scope-tp27816517p27828494.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Cannot find bean: bookList in any scope
Hi i'm new at struts.I wanna write all the array elements which i defined at java class to the jsp file but i'm getting this error javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: bookList in any scope Here is my code Thx for helping Book.JAVA public class Book { private String name; private int price; //private List books=new ArrayList(); Connection con ; Statement ps; ResultSet rs; public ArrayList listBook() throws SQLException { ArrayList books=new ArrayList(); try { Class.forName(com.mysql.jdbc.Driver); con = DriverManager.getConnection(jdbc:mysql://localhost:3306/logintest_development,root,pass); ps = con.createStatement(); rs = ps.executeQuery(SELECT * FROM books); while(rs.next()){ books.add(new perInfoBook(rs.getString(title))); } } catch (Exception e) { System.out.println(Error Data : + e.getMessage()); } con.close(); return books; } public class perInfoBook { String title; int bookid; public perInfoBook(String title) { this.title = title; } public String getTitle() { return title; } public int getBookid() {return bookid;} } } BookForm.JAVA public class BookForm extends ActionForm{ private List bookList; public void reset(ActionMapping mapping,HttpServletRequest request){ bookList=new ArrayList(); } BookAction.Java public class BookAction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BookForm bookForm = (BookForm) form; Book book = new Book(); bookForm.setBookList(book.listBook()); return mapping.findForward(success); } } and here is my jsp code body logic:iterate id=Table name=bookList tr tdbean:write name=Table property=title//td /tr /logic:iterate /body -- View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22bookList%22-in-any-scope-tp27816517p27816517.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org