Jalal
Jalal

Reputation: 1246

Is it possible to send a zipped Object via struts2 to a JSP page?

I'm using Java+struts2+JSP as the web application framework.
I have to pass some huge objects through struts actions to my jsp pages. this makes the pages so heavy to load and on the other hand they suck the server's bandwidth out.
Is there any way to send compressed objects via struts2 to a jsp page and decompress them there?

Upvotes: 0

Views: 551

Answers (3)

Vineet Reynolds
Vineet Reynolds

Reputation: 76709

The question is a bit vague on how the objects are passed from the action classes to the JSP pages, but it appears to me that instead of forwarding the request during the execution of the request, the application is issuing a client-side re-direct to a new page.

In the JSP/servlet model, forwards are internal to the server, and do not result in a new request by the client. On the other hand, redirects will result in the browser being forced to go the new page as indicated by the server.

If possible, you should investigate the use of forwards which is the default mechanism in Struts to display the view. This will only reduce the server's bandwidth requirements.

On the topic of the large memory consumption in JSP pages, you might want to profile the application to deduce whether the 'huge' load time of JSPs is due these objects or whether it is due to the additional client request as explained above. Without such a profile report indicating CPU and memory usage, it is presumptuous to claim that object bloat is responsible for high page load times.

Upvotes: 1

Vincent Ramdhanie
Vincent Ramdhanie

Reputation: 103135

Sounds like you need to unzip files with JavaScript. This Answer actually provides a link to just such JavaScript. I don't know how practical the idea is though.

Upvotes: 0

BarsMonster
BarsMonster

Reputation: 6585

If you need to move data inside your server side, check this:

http://www.google.de/search?q=java+gzip&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a

If you want to improve download speed for clients, enable gzip compression in your webserver.

Upvotes: 0

Related Questions