Forums Register Login

Java JSP Design Issue

+Pie Number of slices to send: Send
I donno how to title this. so may be the subject line i have used is wrong but I can't help it plz.........I dont know if this is the right forum too.
My problem is with JSP, Java and I think Java Script.
I have a JSP. from which I call a custom tag. and in this custom tag, I create an instance of a dynamic class and call a function of it.
JSP --> Custom Tag --> Creation of Dynamic Java Class ---> Call to its function.
In this function, I call the DB. Perform some action and print out the data to the writer. I am facing problem here. I send a query to the DB, get the data and print making the first column as a link. clicking this link should pop up a window or show in the original some data which i get from a different SQL statement for which the condition used is the first column data of each row. That is, the data of the second query depends on the first column data of each row.
now my problem is, after I am done with the first SQL statement, the control goes back to the JSP. here the results are displayed and the user clicks on the first row then I have to go back to the same java class, perform second SQL. this is like instatiating again the dynamic class and all that stuff.
Can something be done with java script here? can I supply the second SQL as an attribute to the request object and use it in the JSP in a java script pop up window? some thing like I call a java class from Java Script with the column value and SQL statement as arguments and print the results there? is it possible?
I really dont understand how to go about this problem. Please don ask me to change the design. I am given this and I cannot do right from scratch.
Please help me.............
Lavanya.
+Pie Number of slices to send: Send
I'm finding it difficult to understand exactly what your problem is.
If it is purely that you don't want to instantiate another object then you could save the first one in the session scope and re-use it later. If you do this you have to be very careful to make it thread-safe.
What is the problem with instantiating the object again ? If you are building a new connection to the database each time then that would be very expensive, but you should be using a connection pool to avoid that.
You won't be able to get client side JavaScript to make a connection to the database though.
I'm doing laundry! Look how clean this tiny ad is:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1267 times.
Similar Threads
Could not synchronize database state with session
Logic problem
Problem with Sybase stored proc in hibernate
call one jsp's java script function to another jsp's javascript function
Dependent drop down list using Struts 1.2 with Ajax DWR
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:42:47.