Re: How to pass an integer array from a form to a JSP page

2002-11-01 Thread Adrian Janssen
In javascript do not pre-size the array, let it grow as it needs to by
adding on to the end as needed (javascript can do this). This way you will
not get all those additional trailing comma's.

In your servelt if you decide you do want to parse the string use the
StringTokenizer class.

 -Original Message-
 From: C. Orlando Monzon [SMTP:[EMAIL PROTECTED]]
 Sent: 31 October 2002 06:10
 To:   [EMAIL PROTECTED]
 Subject:  Re: How to pass an integer array from a form to a JSP page

 Thanks for your suggestions. I was able to pass the array as a String.

 String  myarra = request.getParameter(field_name);

 in my javascript still have the array(256) and when I submit the form a
 function assign myarrayHTML to the field_name.

 It passed like 4,5,3

 Well the String get commas after my entry when I did not fill the array
 with 256 elements as it is the size of the array.

 Well, I got the conclusion that I do not need to change the String (that
 has my array) because in the createStament of JDBC I could use the string.
 I need ofcourse to fix the String to be a good String to include in the
 String that represents my Query.
 So I hope this way I will get my array of integers in my database.
 Question which function or package I need to use to get rid of the commas
 after my entries or to make my string nice to be included in my query?
 Thanks a lot
 Orlando

 ==
 =
 To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff
 JSP-INTEREST.
 For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST
 DIGEST.
 Some relevant FAQs on JSP/Servlets can be found at:

  http://archives.java.sun.com/jsp-interest.html
  http://java.sun.com/products/jsp/faq.html
  http://www.esperanto.org.nz/jsp/jspfaq.jsp
  http://www.jguru.com/faq/index.jsp
  http://www.jspinsider.com
--

It is the strict policy of Truworths that its e-mail facility and all
e-mail communications emanating therefrom, should be utilised for
business purposes only and should conform to high professional and
business standards.   Truworths has stipulated certain regulations in
terms whereof strict guidelines relating to the use and content of
e-mail communications are laid down. The use of the Truworths e-mail
facility is not permitted for the distribution of chain letters or
offensive mail of any nature whatsoever.   Truworths hereby distances
itself from and accepts no liability in respect of the unauthorised
use of its e-mail facility or the sending of e-mail communications
for other than strictly business purposes.   Truworths furthermore
disclaims liability for any  unauthorised instruction for  which
permission was not granted.Truworths Limited accepts no liability
for any consequences arising from or as a result of reliance on this
message unless it is in respect of bona fide Truworths business for
which proper authorisation has been granted.

Any recipient of an unacceptable communication, a chain letter or
offensive material of any nature is requested to notify the Truworths
e-mail administrator ([EMAIL PROTECTED]) immediately in order that
appropriate action can be taken against the individual concerned.

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: How to pass an integer array from a form to a JSP page

2002-10-31 Thread C. Orlando Monzon
Thanks for your suggestions. I was able to pass the array as a String.

String  myarra = request.getParameter(field_name);

in my javascript still have the array(256) and when I submit the form a function 
assign myarrayHTML to the field_name.

It passed like 4,5,3

Well the String get commas after my entry when I did not fill the array with 256 
elements as it is the size of the array.

Well, I got the conclusion that I do not need to change the String (that has my array) 
because in the createStament of JDBC I could use the string.
I need ofcourse to fix the String to be a good String to include in the String that 
represents my Query.
So I hope this way I will get my array of integers in my database.
Question which function or package I need to use to get rid of the commas after my 
entries or to make my string nice to be included in my query?
Thanks a lot
Orlando

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



How to pass an integer array from a form to a JSP page

2002-10-30 Thread C. Orlando Monzon
When I pass an integer I use:

int n = Integer.parseInt(request.parameter(field_name));

but I do not know how to pass an array such   int[] n.

Also in my JavaScript and can create an array. But how can I assign the array to one 
of the values of the form that are going to pass to a JSP page?

So far I have

in the javascript section

var display = new Array(50);


and in the final function for submit the form and have the statement

document.form_name.field_name.value = display

I do not know if this is correct because I can not have success passing this to my JSP 
page. Your help is very appreciated.

Orlando

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: How to pass an integer array from a form to a JSP page

2002-10-30 Thread Padhu Vinirs
String[] strarr = request.getParameterValues(param_name);

Then use Integer.parseInt on each of these array elements.

-- padhu



C. Orlando Monzon wrote:


When I pass an integer I use:

int n = Integer.parseInt(request.parameter(field_name));

but I do not know how to pass an array such   int[] n.

Also in my JavaScript and can create an array. But how can I assign the array to one of the values of the form that are going to pass to a JSP page?

So far I have

in the javascript section

var display = new Array(50);


and in the final function for submit the form and have the statement

document.form_name.field_name.value = display

I do not know if this is correct because I can not have success passing this to my JSP page. Your help is very appreciated.

Orlando

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com





===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com



Re: How to pass an integer array from a form to a JSP page

2002-10-30 Thread Amit Ghaste
u can assign it to a hidden field and then parse the string, then use the
induvidual strings to convert to ints.

i dont think u can assign a array like that to a field value(java script)...
were u able to do that ???

padhu::
another thing... he does not have a bunch of parameters containing the same
name so he cannot use getParameterValues... if he had a bunch of fields
in which he had stored his indvidual values. he could do that.

Suggestion::
in ur javascript parse ur array to a comma seperated value and assign it to
a hidden field then at the jsp get the parameter as usual and parse the
single string into multiple strings... using stringparser and then parse
it to int

hope that helps
amit

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:JSP-INTEREST;JAVA.SUN.COM]On Behalf Of Padhu Vinirs
Sent: Wednesday, October 30, 2002 3:01 PM
To: [EMAIL PROTECTED]
Subject: Re: How to pass an integer array from a form to a JSP page


String[] strarr = request.getParameterValues(param_name);

Then use Integer.parseInt on each of these array elements.

-- padhu



C. Orlando Monzon wrote:

When I pass an integer I use:

int n = Integer.parseInt(request.parameter(field_name));

but I do not know how to pass an array such   int[] n.

Also in my JavaScript and can create an array. But how can I assign the
array to one of the values of the form that are going to pass to a JSP page?

So far I have

in the javascript section

var display = new Array(50);


and in the final function for submit the form and have the statement

document.form_name.field_name.value = display

I do not know if this is correct because I can not have success passing
this to my JSP page. Your help is very appreciated.

Orlando

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff
JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST
DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com




===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff
JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST
DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: How to pass an integer array from a form to a JSP page

2002-10-30 Thread Padhu Vinirs
Didnt read the question correctly. Yep, your suggestion is the way to go.

-- padhu

Amit Ghaste wrote:


u can assign it to a hidden field and then parse the string, then use the
induvidual strings to convert to ints.

i dont think u can assign a array like that to a field value(java script)...
were u able to do that ???

padhu::
another thing... he does not have a bunch of parameters containing the same
name so he cannot use getParameterValues... if he had a bunch of fields
in which he had stored his indvidual values. he could do that.

Suggestion::
in ur javascript parse ur array to a comma seperated value and assign it to
a hidden field then at the jsp get the parameter as usual and parse the
single string into multiple strings... using stringparser and then parse
it to int

hope that helps
amit

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:JSP-INTEREST;JAVA.SUN.COM]On Behalf Of Padhu Vinirs
Sent: Wednesday, October 30, 2002 3:01 PM
To: [EMAIL PROTECTED]
Subject: Re: How to pass an integer array from a form to a JSP page


String[] strarr = request.getParameterValues(param_name);

Then use Integer.parseInt on each of these array elements.

-- padhu



C. Orlando Monzon wrote:




When I pass an integer I use:

int n = Integer.parseInt(request.parameter(field_name));

but I do not know how to pass an array such   int[] n.

Also in my JavaScript and can create an array. But how can I assign the



array to one of the values of the form that are going to pass to a JSP page?



So far I have

in the javascript section

var display = new Array(50);


and in the final function for submit the form and have the statement

document.form_name.field_name.value = display

I do not know if this is correct because I can not have success passing



this to my JSP page. Your help is very appreciated.



Orlando

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff



JSP-INTEREST.



For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST



DIGEST.



Some relevant FAQs on JSP/Servlets can be found at:

http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com







===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff
JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST
DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com





===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:

http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com