*
The moose likes JSP and the fly likes Java JSP Design Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Java JSP Design Issue" Watch "Java JSP Design Issue" New topic
Author

Java JSP Design Issue

Padma Prasad
Ranch Hand

Joined: Sep 16, 2002
Posts: 76
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.
Steve Leach
Ranch Hand

Joined: Sep 24, 2003
Posts: 46
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.
 
Consider Paul's rocket mass heater.
 
subject: Java JSP Design Issue
 
Similar Threads
Could not synchronize database state with session
call one jsp's java script function to another jsp's javascript function
Logic problem
Dependent drop down list using Struts 1.2 with Ajax DWR
Problem with Sybase stored proc in hibernate