Link to home
Start Free TrialLog in
Avatar of manojvashisht
manojvashisht

asked on

How to make Table on jsp by parsing a string of records

hi
i want to make ajax call on click of a icon,such that it calls a struts action in background which hits the db and fetches the records from a oracle DB in a map or list. now i want to populate a div on the same jsp where the icon was with the records shown in a tabular form. this all has to be done without reloading the complete page.such that when user clicks the icon a div comes up and the controls on rest of the page becomes un acessible. the query result can have n number of records to be displayed.i need this solution urgently.please provide with some sample code or examples.also i cudnt use ant third part frameworks like json,dojo.please help me in this.
SOLUTION
Avatar of Murali Murugesan
Murali Murugesan
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of manojvashisht
manojvashisht

ASKER

Hi
This link talks about showing table of data in a popup window,where as i need to show the data in the same jsp by populating a div as a highlighted area,i want to do the same using the ajax in background doing the records retrieval in background.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi

what you have posted provides a clear picture,but as i am very new to ajax and java stuff i have few queries if could look into.
1) how i could make a XML document for the records coming from DB suppose i have 5 columns per row to display like   name,ID,Phone,City,Zip  for n number of rows i.e it could be 2 rows at one hit and 100 rows next time i hit the Db. i you could provide some code snippet.

2) How could the xml could be parsed at the client side with javascript, suppose i have this XML

<data>
<name>mack</name>
<Id>234</Id>
<City>delhi</City>
<data>
<data>
<name>Ram</name>
<Id>235</Id>
<City>delhi</City>
<data>
<data>
<name>Anuj</name>
<Id>236</Id>
<City>delhi</City>
<data>
.
.
.
.upto n how the same could be parsed,like how to check how many nodes it have then running a loop for the same.then setting thesame into table for display

Open in new window

any updates??
i need to solve it urgently
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can you show any example,because i am not very clear about how to make a table for resultset in java.

how the data from list would be populated in html table
hi actually i am very new  to all this stuff.a little more help from ur side is highly appreciated.

i am confused that if my DB query returns 50 records in a list .how i would put these records as html output and populate them in a div.

basically making a table to display those on jsp then.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you mean to say that suppose for 50 records i will have to keep appending the values.

if this is the case then this confuses me more because how would i create such a large string.

can you help me with any logic or some kind of loop for a method to append the values
also i am not using any servlet, i am calling a action which processes the db for updates,can u please provide what changes have to be made in struts config for this action mapping
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi
I have a query,when i will call the struts action and then parse the db results to make a stringbuffer,
the struts action would give a forward,in this case the page would be reloaded or not
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I believe I gave you only the final piece of puzzle, Murali's comments helped you to achieve the overall solution.
Please redistribute the points.
thanks for the recommendation Kuldeep.
hi i really didn't  knew whether accepting grants all the point at the level it was accepted.

my sincere apologies ,ofcourse it was murali kanth's comments which helped me get going.

but the problem is how to re assign ,please suggest
Even i m not sure of how to re-assign the points, probably i would raise a "Request attention" so that the zone advisor would get into picture and you can tell him about the re-assignment.