This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I am stuck up in following problem.. I've to use this concept in my application. getter and setter methods are used in Beans for getting/setting values from JSP. So far I've seen only one data 'string' in setter methods when it is set thru JSP. What to do when we want to set "array of strings" thru JSP. Suppose application prompts user to give size of a two dimensional string array( a X b) If user enters 2 X 3 , then next JSP page should give a grid to enter data in 2 X3 format. Now how to take these values in variables and user setter methods of bean to take value in two dimensional array ?? How the variables in JSP/HTML will be named in such case when columns and rows both are variables ??? Please HELP ???
Early bird catches the worm, but remember "early worm" gets caught by bird.
You can use javascript/HTML form field to receive the input from the user (the value of each cell in the 2D array). Use a loop to generate the HTML, otherwise, you'll be hardcoding <TD> tags forever if your 2D array is large. For instance,
Now, as part of your form, you will have a table cell with the name of the row, followed by a '#' delimiter, and then the column(i.e. "0#0", "0#1", "1#0", "1#1"...). This makes it easy to parse the names. When you submit this form, the page which accepts the submission will have a similar loop to iterate through each parameter and store the value in your Java 2D array. Hope this helps, WS
for (int i = today; i < endOfTime; i++) { code(); }