i have a jsp page which initializes itself from a database...it has a series of checkboxes that are being created from the database values...now once the user selects the boxes required by him i have designed a function dat reads the values from the checked fields n stores them in an array of variables...i want to pass this variable to another page....pls help...need this work done by tomo mrng.........thnx in advanced

If you share with us how you

designed a function dat reads the values from the checked fields n stores them in an array of variables

we may share with you how to pass it to next page

var roll = new Array(field.length);
            var pa = new Array(field.length);
            for(i=0;i<field.length;i++)
                {
                    roll[i]=field[i].value;
                    if(field[i].checked==true)
                        {
                            pa[i]=1;
                        }
                        else
                        {
                            pa[i]=0;
                        }
                 }

AFAIK you cannot pass values assigned to variables in Javascript to your Server Side JSP pages without putting the actual values inside some form fields viz. the "input" element (eg hidden fields, text fields etc) or "select" element etc.
Either that our you can pass them as part of the invoking URL eg http://xxxxxx/page.jsp?value1=ccc&value2=vvvv....

Hi,
You can pass formdata to another jsp through attribute action="ur.jsp"...

<form name=f id=f method=post action=ur.jsp>
<input type=checkbox1  value=y />
<input type=checkbox2  value=y />
</form>

then in "ur.jsp" .. write code something like this..
----------------------

String c1 = request.getParameter("checkbox1");
String c2 = request.getParameter("checkbox2");

--------
Now c1 will get String value "y" if checkbox1 is checked,
c2 will get String value "y" if checkbox2 is checked.

I hope this is what u want....

sumthin like dis....
but 1 prblm....dis is being done in a function called on pressing da submit button..so can the input type be created within the javascript function being called n if yes they need to be posted automatically to a "process.jsp"...how can that be done....thnx for ur hlp....really appreciate it...

As already stephen said you cannot pass JavaScript stored variables to another JSP.

PS: Would be nice if you start using full sentence English, as the above is against forum rules

I made a mistake in my html code...... i m repairing that........

<form name=f id=f method=post action=ur.jsp>
<input type=checkbox name=checkbox1 value=y />
<input type=checkbox name=checkbox2 value=y />
</form>


-----------------------------

Now if you want to make call another jsp through javascript function
without using submit....... then you can use AJAX.

Ok.Fine . Then can anyone help me design a javascript function that updates a database.pls..... I need help urgently.

As far as I know JavaScript is not able to access & communicate with any database directly. AJAX is able to do so, but then you would have to learn that. Why you want to connect from JSP to database through "side kicks" when you have at your hands full power of Java?

PS: If you insist on connection to be done by other technology, then this thread is in wrong section...

The thing is variables required for database access are being provided by javascript. But as javascript cannot read a database dey r left redundant. is der sum way to pass the to the jsp script within the javascript function.Also i do not need any other technology to work this function.

This question has already been answered. Start a new discussion instead.