PDA

View Full Version : datasets problem


thriputapriya
07-20-2004, 07:37 AM
Hi Antun,

In my example code i have problem,here i am using the one dataset for loading that data from database.But i want read different values from same dataset.First time i will read one value for a text by passing one value through setParams method.At second time if i try to read the second value for another text by passing second values at that time the later loaded old values are updated by the new ones. How to rectify this problem for same dataset.

this is below code snippet:

<dataset name="mydataset" src="mydata.jsp" autorequest="false" type="http" />

<tree open="true" text="World">
<tree text="Country" isleaf="true" />
<tree open="true" text="State">
<method event="onclick">
var topic=canvas.datasets.mydataset;
var t1="StateName";
topic.setQueryParams({ topic:t1} );
topic.doRequest();
</method>
<view datapath="sub_category">
<tree datapath="text()" isleaf="true"/ > </view>
<tree text="StateName2" isleaf="true" />
<tree text="City1" isleaf="true" />
</tree>
<tree open="true" text="City2" >
<method event="onclick">
var topic=canvas.datasets.mydataset;
var t1="City2";
topic.setQueryParams({ topic:t1} );
topic.doRequest();
//arttxt.showcontent();
</method>
<view datapath="sub_category">
<tree datapath="text()" isleaf="true"/ >
</view>
</tree>
</tree>

Thanks,
-thriputapriya

antun
07-20-2004, 09:48 AM
I think there's a bug with setQueryParams that means that the second time it's called it doensn't overwrite the paramaters that were set the first time. Try calling setQueryString( "?topic="+t1 ), and see if that fixes the problem.

-Antun

raven
07-21-2004, 05:38 AM
What does your mydata.jsp look like?

I guess I am just confused as to how the data gets from jsp page to dataset. Does it have to be formatted a certain way so that the dataset can read it?

I think I just need to spend more time RTFM :)
M@

thriputapriya
07-21-2004, 06:43 AM
Yes, what you thought is correct it is just formatted xml tags.Data will get from databse by using jsp, in that i write some sql statement to retrieve the data and this data will pass into formatted xml tags.So that i can read that dataset from lzx.

raven
07-21-2004, 07:23 AM
That's the part I am really interested in. How do you take a result set from a db using JSP and insert into xml tags?

Can you post a snippet, or maybe a website where there might be an example?

antun
07-21-2004, 12:06 PM
Traditionally people use JSPs to write out HTML. You make a database query and present that information as an HTML table.

Instead of generating HTML, you use the JSP to write XML - it's that simple. There's a tutorial on how to connect to a database and write out HTML here:

http://www.jsptut.com/Sql.jsp

... just did a Google search on "jsp database tutorial".

Now if you're not that familiar with JSPs in the first place, I'd avoid going with servlets/JSPs as your server-side technology of choice. Instead, opt for something like PHP or ASP which is much easier to get into. The downside is that you'd have to install PHP or IIS; since the LPS is a servlet, the servlet container that powers JSPs or other servlets is already present.

-Antun

That's the part I am really interested in. How do you take a result set from a db using JSP and insert into xml tags?

raven
07-21-2004, 12:51 PM
doesn't have to be jsp's:)

So you are saying that I should try to find somewhere that will demonstrate a php query result parsed into XML?

Sorry if this seems obvious - I am a father of 2 and feel like I am losing my mind sometimes:)

M@

antun
07-21-2004, 12:56 PM
That's right. Also, I forgot to mention that there's an excellent tutorial on building data-driven applications. It talks about JSPs:

http://www.laszlosystems.com/lps-2.1.2/tutorials/data_app_6.html

-Antun

So you are saying that I should try to find somewhere that will demonstrate a php query result parsed into XML?

thriputapriya
07-22-2004, 01:37 AM
Hi Antun,

your quote:
-------------------------------------------------
I think there's a bug with setQueryParams that means that the second time it's called it doensn't overwrite the paramaters that were set the first time. Try calling setQueryString( "?topic="+t1 ), and see if that fixes the problem.
--------------------------------------------------
In my example code i tried your approach as calling setQueryString("?topic="+t1),but it is nothing changes in (problem) result.I am facing same problem(what i said in my first post) now also. What i think, it is problem with using same datasets for different values.If i call setParams or setQueryString which will updated for all datapath values which are those reffered to same datasets.Could you give me any other way or approach to solve this problem.

With regards.
-thriputapriya

antun
07-22-2004, 11:49 AM
Can you see what request the app is actually making? You can use something like Proxomitron or a Mozilla/Firefox plugin to intercept HTTP requests from your browser, and check out what the actual request looks like.

-Antun