aspose file tools*
The moose likes JSP and the fly likes JSP and Bean best practise! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP and Bean best practise!" Watch "JSP and Bean best practise!" New topic
Author

JSP and Bean best practise!

Sejal Patel
Greenhorn

Joined: Apr 14, 2005
Posts: 1
Hi all,

I am working with JSP on JavaWebServer /Unix / Oracle9i background.


I have to analyse the performance of the website that uses JSPs and Bean.


The present structure is as follows.

->The Bean is having Connection pool to manage 100 connections.
->It also has a method to take a 'procedure name' as input and return the RESULTSET (object).
->All JSPs
-get connection from pool
-cal gc.
-call the above method, casts the RESULTSEt and using the resultset to display the data.
-return connection to pool
-call gc.

Now wht the problem is when 10s of our branches are updating the data on our website,
atleast once in a day JavaWebServer goes down!!!

We checked for the memory leakage but i think there is no problem with it as in the beggining of the JSP and at the end of JSP Java's free memory is the same ...


So wht i can think is the other way of using Bean and JSP that is,
Instead of getting RESULTSET Object from bean we can have M*N matrix of String type which we can directly use in JSPs...
(Return the data only not the resultset object, getting my point no?)
**** Will this idea make the performance better or this is the problem of JavaWebServer...



PLEASE correct me if i m wrong somewhere!
And let me know yr views too... this will help me to start the journey again... i m new in the organization...

Thanks to all,
Sejal
Annie Smith
Ranch Hand

Joined: Mar 05, 2005
Posts: 172
IMO, you should consider the following points:
1. I'm not sure how you handle the connections from the connection pool, but I assume that you are ensuring that they are closed after use. Calling close() on Connection object would release the resources held up during it's creation. I do think you have a proper connection handling logic.
2. I don't think calling GC would help. It doesn't ensure release of resources/freeing of memory.
3. I don't think using a multidimensional array (matrix) is a good idea of fetching data from the resultset. You could use Collection objects like ArrayList, containing objects of some bean to hold the data.
4. Since you mention all JSPs, I would suggest you to have some plain Java classes which would separate the processing logic from the presentation logic. The purpose of a JSP is to have an easy presentation logic.

These are just suggestions and all of them do on actually boost the performance. But they would certainly make life easier while maintaining code.


Cheers!<br /><b>Annie</b>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP and Bean best practise!
 
Similar Threads
Closing Database Connections
long post IBM.158
Releasing objects on multiple requests
database access from JSP
which is better resultset ->xml+xsl-> html or resultset->list-> jsp performance wis