Hi friends, I involved in a project and recently i get up from a big mess up in MySQL. After that,i do another mess up. There i need the resultset obtained in the servlet page(A bean file) to be passed to the Invoking Servlet file and then it can be accessed by JSP file. I tried so many ways i even use session to bind the resultset and pass it it JSP page it seems to be not a good one. Here i found the code and i need your help where i use it and how i access it in my JSP page..
Any help will be appreciated...
Never try to be a hard-worker. Be a smart-worker.
Would you please give me an example code 'cause i do accordingly to your instruction but i can't get it and i really messed things as a whole.
Joined: Sep 11, 2005
1. You have given us 2 methods named resultSetToArrayList() and arrSend(), I can see you are calling the latter from doPost(), where are you calling the other one? Should it be used?
2. Are you sure the list "blah" you want, has the correct results in the format you need?
3. In general, you might have to do these in doPost(), so the data correctly gets transferred to the JSP. 3.a. After you properly populate "mb", the bean, in doPost() of the servlet, you have to set it as an attribute in the request object
3.b. After this, you have forward the request to your JSP page.
3.c. You can then access this bean in report.jsp as follows:
Please note that the attribute will be available only if you forward/include using RequestDispatcher. If you use response.sendRedirect(), you would lose the request attributes.
The suggestions which the people have given so far would work for you. Not sure why you could not get the results into your jsp, unless you are actually creating a new request object (Not the one having hte resultset). This can happen if you do a redirect I believe, instead of RequestDispatcher forward or include. Try to check if the request objects are same on jsp page and in servlet. If they are same, then the Resultset should be available, if not obviously Resultset would not be available.
Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
I am using AJAX along with JSP to pass the value of combo box to servlet and to fetch the value from DB without refreshing the page but it fails to works and the ajaxFunction is not triggered when i select a value from combobox. Here is the AJAX code for that
Will someone please tell me this function is to just pass the value to servlet. How can i fetch my data from server to AJAX. I right now use session to put my values and get it through in my JSP page.But it shows null values in the session field.Please give me a solution