View Full Version : read the request parameter
mohan
07-28-2003, 11:46 PM
hi,
how do i read the content of the custompulldownbox (request parameter) when submitting the particular lzx file and get that content in jsp file so that i can query the database according to the content in the custompulldownbox.
and also can u give me the example code that contain how to get the images which are stored in the database
and display in the lzx file.That images are should be load according to the content of the custompulldownbox .
with cheer's
mohan
antun
07-29-2003, 07:59 AM
You mean the custompulldown I posted a while back? I believe it has a retrieveData() method for getting a string of what was selected, so you'd do something like:
<canvas debug="true" width="800">
<include href="custompulldown.lzx" />
<!-- custom pulldown assets -->
<resource name="pull_box_butt" src="assets/pull_button.swf" />
<resource name="pull_black_outline" src="assets/pull_outline.swf" />
<!-- Dataset that will receive the response from the jsp -->
<dataset name="myRemoteData" type="http" autorequest="false"
src="http://mysite.com/myservice.jsp" />
<dataset name="months">
<month>January</month>
<month>February</month>
<month>March</month>
</dataset>
<custompulldown name="leaveMonth" x="400" y="60" width="142"
itempath="months:/month/text()" />
<button onclick="debug.write( )">
<method event="onclick">
// Get the selected value
leaveMonth.retrieveData();
// Set the querystring on the dataset
myRemoteData.setQueryString( { month : leaveMonth } );
myRemoteData.doRequest();
</method>
</button>
</canvas>
When the data comes back to the "myRemoteData" dataset, it will be an xml file. I'm not sure exactly how much data or how many image URLs you're going to be getting back, but if it's just one, you'll need to extract the URL from the XML first. For that you'd use a datapointer to get to the precise value in your dataset. See the LZX Reference on datapointer:
http://www.laszlosystems.com/developers/learn/documentation/lzxref/datapointer.php
or the Data Tutorial for that:
http://www.laszlosystems.com/developers/learn/documentation/tutorials/data.php#datapointers
Datapointers are generally used when you have to get a specific value out of an XML dataset (e.g. the foo attribute of the second <bar> tag).
Once you've got your URL, you'll call the setSource() (http://www.laszlosystems.com/developers/learn/documentation/lzxref/view.php#meth-setSource) method on the view you want to hold the picture.
You'll have to do this all when the data comes back to the dataset (you could have an ondata event attached to a datapointer, to make sure it happens at the right time).
If you were to get several images back in your data, then the better approach would be to use data replication. See the source for the Weather Sample App here:
http://www.laszlosystems.com/lps-v1/viewer/viewer.jsp?file=/sample-apps/weather/weather.lzx
-Antun
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.