PDA

View Full Version : changing the key dynamically in side the setQueryParams()


thriputapriya
08-18-2004, 07:46 AM
Hi Antun,

Here I am trying to send the information about each subview of a view(like it's width ,hieght x,y etc..)
by using
save.setQueryParams(key : value) inside the for loop.

<method event="onclick">
<![CDATA[
var save= canvas.datasets.sampledata;
for(var i=1 ;i<galshow.subviews.length;i++)
{
save.setQueryParams({rotate: galshow.subviews[i].rotation});
save.setQueryParams({ imagename : galshow.subviews[i].datapath.xpathQuery('Image/text()')} ) ;
save.setQueryParams({ imagewidth : galshow.subviews[i].width} ) ;
save.setQueryParams({ imageheight : galshow.subviews[i].height} ) ;
save.setQueryParams({ imageX : galshow.subviews[i].getBounds().x});
save.setQueryParams({ imageY : galshow.subviews[i].getBounds().y});
}
]]>
save.doRequest();
</method>
but here i want to change the key which i am using inside the setQueryParams() method, in order to distinguish each "keys and value" pairs for each subview

like i want to append the value of the variable "i" to the keys of first subview and incrementaed value of the "i" to the keys of second subview and so on ,in order to distinguish the first key of the first subview from the first key of the second subview

like
save.setQueryParams({rotate + i: galshow.subviews[i].rotation});
save.setQueryParams({ imagewidth + i : galshow.subviews[i].width} ) ;so on....

if i am do so i am getting compile time error .

So how do i solve the above problem ?

and also i am reading the corresopnding data in the jsp using ,
Enumeration paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {
String paramName = (String)paramNames.nextElement();
System.out.println(" " + paramName );
}

Thanks in advance
T. priya

thriputapriya
08-20-2004, 07:50 AM
HI Antun,

Regarding to my previous post,

In our application, an user can upload as many as images and each image is created as subview under a parent view.And also i am trying to store the information(width,height,x position y position, etc..)of a subview(image) into the database.for that i am
using the below code to send it to serverside script (jsp).
<method event="onclick">
for(var i=0 ;i<galshow.subviews.length;i++)
{
save.setQueryParams({ rotate : galshow.subviews[i].rotation});
save.setQueryParams({ imagename : galshow.subviews[i].datapath.xpathQuery('Image/text()')} ) ;
save.setQueryParams({ imagewidth : galshow.subviews[i].width} ) ;
save.setQueryParams({ imageheight : galshow.subviews[i].height} ) ;
save.setQueryParams({ imageX : galshow.subviews[i].getBounds().x});
save.setQueryParams({ imageY : galshow.subviews[i].getBounds().y});

}
]]>
save.doRequest();
</method>

and aslo i am getting these values by using request.getParameterNames()in jsp like

Enumeration paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {

String paramName = (String)paramNames.nextElement();
System.out.print(" " + paramName +":");


paramValues =request.getParameterValues(paramName);

for(int i=0; i<paramValues.length; i++) {

System.out.println(paramValues[i]);
}
}

here my problem is, if the user upload more than one image,only the latest image's information is available in the JSP.The for loop in the lzx file executes as many times as subviews in the view but it overwrite
the keys in the setQueryParams(key,value)instead of generating one more set of information for each subview.and also i could'nt able to change the key in the above method by appending the value of "i"(for make it unique from the previous key).

like
save.setQueryParams({ rotate+i : galshow.subviews[i].rotation});for each iteration in the loop.

So How can i send all the information about the images, if an user upload more than one image to the database using the above code ?like if an user put 2 images there should be 2 sets of information and if an user put 3 images there should be 3 sets of information so on.. to send it to jsp

Hope u under stand my question

Thanks
T.priya.

thriputapriya
08-30-2004, 09:16 PM
Hi antun,

Hi Antun,

Here I am trying to send the information about each subview of a view(like it's width ,hieght x,y etc..)
by using
save.setQueryParams(key : value) inside the for loop.

<method event="onclick">
<![CDATA[
var save= canvas.datasets.sampledata;
for(var i=1 ;i<galshow.subviews.length;i++)
{
save.setQueryParams({rotate: galshow.subviews[i].rotation});
save.setQueryParams({ imagename : galshow.subviews[i].datapath.xpathQuery('Image/text()')} ) ;
save.setQueryParams({ imagewidth : galshow.subviews[i].width} ) ;
save.setQueryParams({ imageheight : galshow.subviews[i].height} ) ;
save.setQueryParams({ imageX : galshow.subviews[i].getBounds().x});
save.setQueryParams({ imageY : galshow.subviews[i].getBounds().y});
}
]]>
save.doRequest();
</method>
but here i want to change the key which i am using inside the setQueryParams() method, in order to distinguish each "keys and value" pairs for each subview

like i want to append the value of the variable "i" to the keys of first subview and incrementaed value of the "i" to the keys of second subview and so on ,in order to distinguish the first key of the first subview from the first key of the second subview

like
save.setQueryParams({rotate + i: galshow.subviews[i].rotation});
save.setQueryParams({ imagewidth + i : galshow.subviews[i].width} ) ;so on....

if i am do so i am getting compile time error .

So how do i solve the above problem ?

and also i am reading the corresopnding data in the jsp using ,
Enumeration paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {
String paramName = (String)paramNames.nextElement();
System.out.println(" " + paramName );
}

Thanks in advance
T. priya

thriputapriya
10-13-2004, 06:55 AM
HI Antun,

Regarding to my previous post,

In our application, an user can upload as many as images and each image is created as subview under a parent view.And also i am trying to store the information(width,height,x position y position, etc..)of a subview(image) into the database.for that i am
using the below code to send it to serverside script (jsp).
<method event="onclick">
for(var i=0 ;i<galshow.subviews.length;i++)
{
save.setQueryParams({ rotate : galshow.subviews[i].rotation});
save.setQueryParams({ imagename : galshow.subviews[i].datapath.xpathQuery('Image/text()')} ) ;
save.setQueryParams({ imagewidth : galshow.subviews[i].width} ) ;
save.setQueryParams({ imageheight : galshow.subviews[i].height} ) ;
save.setQueryParams({ imageX : galshow.subviews[i].getBounds().x});
save.setQueryParams({ imageY : galshow.subviews[i].getBounds().y});

}
]]>
save.doRequest();
</method>

and aslo i am getting these values by using request.getParameterNames()in jsp like

Enumeration paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {

String paramName = (String)paramNames.nextElement();
System.out.print(" " + paramName +":");


paramValues =request.getParameterValues(paramName);

for(int i=0; i<paramValues.length; i++) {

System.out.println(paramValues[i]);
}
}

here my problem is, if the user upload more than one image,only the latest image's information is available in the JSP.The for loop in the lzx file executes as many times as subviews in the view but it overwrite
the keys in the setQueryParams(key,value)instead of generating one more set of information for each subview.and also i could'nt able to change the key in the above method by appending the value of "i"(for make it unique from the previous key).

like
save.setQueryParams({ rotate+i : galshow.subviews[i].rotation});for each iteration in the loop.

So How can i send all the information about the images, if an user upload more than one image to the database using the above code ?like if an user put 2 images there should be 2 sets of information and if an user put 3 images there should be 3 sets of information so on.. to send it to jsp

Hope u under stand my question

Thanks
T.priya.