| Author |
Sharing array with Javascript in JSP?
|
Judy Herilla
Ranch Hand
Joined: Jan 05, 2001
Posts: 89
|
|
I want to make an array that is generated from a checkbox group in an HTML request persist through multiple calls to the server, without setting it n the session. I can get the array in my JSP from the request.getAttribute, but how can I pass this into Javascript, or set it so that it gets sent up to the server again? Is it possible? Thanks.
|
SCPJ2
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
Johanna, I'm nit sure exactly what you are trying to do, but the following may help. If you have a Java array that is in scope during JSP execution, you can create a corresponding JavaScript structure. Perhaps something along the lines of: I don't know if that really addresses your problem or not, but I thought I'd throw that out in case it helps. bear [ April 16, 2002: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Yashnoo lyo
Ranch Hand
Joined: Feb 17, 2003
Posts: 152
|
|
Hi: I come across the same problem.But I can't do this use this method. I want to send array from send.jsp to get.jsp. ///////////////////////////send.jsp////////////////////////////// //////////////////////////get.jsp//////////////////////////////////// I want to get all the array when I click the button in get.jsp.But what I get is "undefine,undefine,undefine,yashnoo". Why? How to do this or is there any error in my code ? Thks!
|
When I face C# and Java I choose Java.
|
 |
Yashnoo lyo
Ranch Hand
Joined: Feb 17, 2003
Posts: 152
|
|
I want get the array when I click the button in get.jsp. ////////////////////////////get.jsp/////////////////////////////]
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
|
|
If this was my problem I would write Javascript to create the array outside of any JS function. Here is an example - created inside <script language="JavaScript"> by Java print statements. You say:
I want get the array when I click the button in get.jsp.
but remember, you click the button on the browser side in HTML written by the JSP - sometimes people new to JSP don't keep in mind how separate the browser and JSP actions are. Bill
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: Sharing array with Javascript in JSP?
|
|
|