File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Having some multidimensional array problem in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Having some multidimensional array problem in JSP" Watch "Having some multidimensional array problem in JSP" New topic
Author

Having some multidimensional array problem in JSP

derrick tan
Greenhorn

Joined: Jul 29, 2006
Posts: 11
hi, i'm looking for someone to help me... i really not familiar with jsp... i have under training in a company which they have no one expert in JSP... so i really need some help for all of you... can someone help me... my problem occur at the bottom parts of the program... i have written some comments beside the problem parts... so hope that those who wanna help me in this program can understand wat happens to my program... Thanks...

<html>
<head><title>Plan Printing Purchase Order Form</title></head>

<body>
<b> PLAN PRINTING PURCHASE ORDER FORM</b>
<form action = purchaseOrderForm.jsp method = post>

<table border = 0 cellspacing = 0 cellpadding = 0>

<% String[] textFields = {"TO","PROJECT","DATE","REF NO","CONTACT NAME"};
for(int j=0; j<textFields.length; j++){ %>
<tr>
<td> <b> <%=textFields[j]%>: </b> </TD>
<td colspan = 2> <input type = text name=<%=textFields[j]%>> </td>
</tr>
<% } %>

<table>
<tr>
<td> <i> O.C.E/XEROX <input type = "checkbox" name = oce value = "OCE"/></i> </td>
<td> <i> REDUCE <input type = "checkbox" name = reduce value = "REDUCE"/></i> </td>
<td> <i> ENLARGE <input type = "checkbox" name = enlarge value = "ENLARGE"/></i> </td>
<td> <i> AMMONIA <input type = "checkbox" name = ammonia value = "AMMONIA"/></i> </td>
</tr>
</table>

<table>
<tr>
<td align = center> <b> TYPE OF PRINT </b> <td>
</tr>

<tr align = right>
<td> <i> TRACING TO PAPER <input type = "checkbox" name = TOP value = "TRACING TO PAPER"/></i> </td>
</tr>

<tr align = right>
<td> <i> PAPER TO PAPER <input type = "checkbox" name = TOP value = "PAPER TO PAPER"/></i> </td>
</tr>

<tr align = right>
<td> <i> PAPER / TRACING TO PAPER <input type = "checkbox" name = TOP value = "PAPER/TRACING TO PAPER"/></i>
</tr>

<tr align = right>
<td> <i> TRACING TO INTERMEDIATE <input type = "checkbox" name = TOP value = "TRACING TO INTERMEDIATE"/></i>
</tr>
</table>

<tr><td> </td></tr>
<tr><td> </td></tr>

<tr>
<td> <b> <i> How many request? </i> </b> <input type = "text" name = "numRequest"> </td> //numRequest will be used in the below
</tr>

</table>

</br>

<table border = 1 cellspacing = 1 cellpadding = 1>

<tr>
<td> <b><i> SIZE </b></i> </td>
<td> <b><i> No. OF ORIGINAL </b></i> </td>
<td> <b><i> NO. OF COPIES TO PRINT </b></i> </td>
<td> <b><i> TOTAL NO. OF PRINTS </b></i> </td>
</tr>

<% int num = numRequest.text; //numRequest is how many request that user key in
String[][] requests;
for(int j=0; j<num; j++){ %>
<tr>
<% for(int k=0; k<4; k++){ %>
<td> <input type = text name = request[j][k]> </td>
<% } %>
</tr>
<% } %>

</table>

<input type = submit value = "submit"/>
</form>

</body>
</html>


Best regards,<br />derrick<br />~Thanks in advance~
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Here are some tips on how to use JavaRanch as a resource.

First, use UBB code tags to preserve the formatting of your posted code. The CODE button under the text area will help you out.

Secondly, be complete. You stated something about embedding comments in the code that explain the problem. I can't find any, and that's not a great idea to begin with. Making people work hard to try to help you is a good way to ensure that they don't.

And lastly, post your question exactly once. Posting it more than once, either in the same or across multiple forums here will not win you any friends or get your question answered sooner.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
derrick tan
Greenhorn

Joined: Jul 29, 2006
Posts: 11
sorry, i just a 1st time to post this kind of question.. actually i get the website from one of my fren, and i'm a new learner for JSP.. i'm also feel very sorry to post so many times... actually i just want to post one time, but my internet line got a bit problem... so maybe i click too many times to post it... so sorry about this... actually i face the problem about the multidimensional array at the bottom part( nearly end of the programs)... i can't passed the value from the user to list out how many line in the table...

i have try to put UBB code for the problem... can u try to help me again...
The following code is what i have post to forum... but i have add in some UBB code already.... actually the other part of the program actually can function already... bcos i have already take out and try to display... The following is just part of the program which is the part that i don't u/stand... the full program u can refers back to the original program...

<td> <b> <i> How many request? </i> </b> <input type = "text" name = "numRequest"> </td> //numRequest will be used in the below
</tr>

</table>

</br>

<table border = 1 cellspacing = 1 cellpadding = 1>

<tr>
<td> <b><i> SIZE </b></i> </td>
<td> <b><i> No. OF ORIGINAL </b></i> </td>
<td> <b><i> NO. OF COPIES TO PRINT </b></i> </td>
<td> <b><i> TOTAL NO. OF PRINTS </b></i> </td>
</tr>

[problem part] // Im doing a requisition form, i try to let user enter (value) how many request he want. So i can pass it to for loop then the form can generate request according to the value.

i can't passed the value in... can u tell me what is the problem...

<% int num = numRequest.text; //numRequest is how many request that user key in
String[][] requests;
for(int j=0; j<num; j++){ %>
<tr>
<% for(int k=0; k<4; k++){ %>
<td> <input type = text name = request[j][k]> </td>
<% } %>
</tr>
<% } %>
[/problem part]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Having some multidimensional array problem in JSP
 
Similar Threads
How to validate that in each row how many checkboxes are checked
Javascript error
Problem while receiving parameters..
Passing more than one object between jsp and servlet
passing values to a pop up window (SOS)