Problem pass values from page JSP to another page JSP
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Now the questions:
1 - Is it possible to have 2 ResultSet (one to retrieve the data that came from the previous page and another to count the number of records in that table)?
2 - Assuming that the question above is positive, with the number of students, it is possible to create a for loop so that each entry of the table created on the 3rd page for each of the 10 values can be stored in an array (of String or int) and then sent to a last page that will show the result (positive if it managed to persist in the bank or negative if there was a problem)? Here is the structure of the application:
index.jsp
--- receives user login data
--- ok, go to login.jsp
login.jsp
--- sets up 2 select's fields for the user to select bank information
--- sends this information to abreClasse.jsp
openClass.jsp
--- assembles a table with the information passed from the select fields
--- In the table, "input" fields are also created for the data that will be persisted in the database
--- send this information to saveNotes.jsp
saveNotes.jsp
--- tries to persist the data in the database
--- if so, it gives a success message and other options to exit, edit
--- if not, it gives an error message and gives the option to redirect to the beginning of the process (login.jsp)
I have a link to an image of how the table looks after being assembled in the file abreClasse.jsp (with the selection of the select's fields) image link -->(https://flic.kr/ps/42dmnJ). If necessary, I can send the files. The problem is that the way it is (as I did) the values are going with a null value, for the last page. Thanks in advance.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Paul Clapham wrote:Those are all perfectly reasonable things to do. Only, choosing to do them in JSPs is not a reasonable thing to do. People would normally choose to do that logic in a servlet and then forward to a JSP to format the result (using JSP EL) into HTML for the user to read.
Right! Can I show you my codes for you to evaluate?
Thanks for help me and answering!
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
It's also possible that you're trying to code everything all at once and that you can't tell where the problem is. It's better to work on one thing at a time before working on the next thing. For example a servlet which does that database extraction and processing is a reasonable unit of work, and a JSP which displays the results is another reasonable unit of work.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Paul Clapham wrote:Post things here if you want to ask about them. But I don't think you need to post the whole lot. I get the impression that the logging-in part is okay. And it isn't clear whether you're having problems generating the data to be displayed in the last output screen or whether you're having problems displaying that data.
It's also possible that you're trying to code everything all at once and that you can't tell where the problem is. It's better to work on one thing at a time before working on the next thing. For example a servlet which does that database extraction and processing is a reasonable unit of work, and a JSP which displays the results is another reasonable unit of work.
OK. Now my problem as follow: I can retrive from DB and assemble the table, but when I put some code, return just 1 record. I remove work´s fine again. Is like this:
to get data from user in this page, so if I put this:
only retrive the first record. And this drive me crazy, because I´m stopped at this for 1 week. Thank´s for watching. Regards.
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
First of all, it's using scriptlets and that's obsolete. Secondly, not all HTML attributes can be assigned dynamic values using EL. I don't know offhand about "name", but "id" can NEVER be assigned a varying value.
Assuming you want to retrieve database rows in a dispatcher (controller) servlet and display them in an HTML table, forget this complex stuff and look at the JSTL "forReach" tag and its use.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
| What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad. The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |











