The index.jsp contains java codes which will fetch some images and texts from a database.
In the JavaScript file I wrote.
$(document).ready(function(){
//When Document is Ready, Show the Main Page
$("#showifjavaenabled").fadeIn(1000);
});
So in the beginning, the DIV showifjavaenabled is hidden, but I noticed that even when it shows up after 1 second, not all java are executed because they are actually a lot, the time they need to load isn’t big, it’s only a second or two, but still it’s looking bad, how can I .show() or .fadeIn() this page only after all java codes have been executed?
This is one of the reasons for not putting java code into JSPs…
If you are doing server-side business, you should do it server side, then forward the request to the JSP with all data already loaded.
OR you can use AJAX calls to perform Java frontend operations, using kind of tiles (the page is loaded, the little box loading with ajax has still the progress bar running until he’s done.
Avoid scriptlets (
<% %>) as much as you can, and separate concepts for a better results.EDIT:
You should really try to start with some framework like Struts2 (not Struts1, that is harder and less powerful).
It’s not difficult, well documented, and the time you spend to learn the ‘hello world’ and to setup your application will come back immediately in terms of power and easyness, and you could use it for future applications.
Posting a gigantic comma separated string from server to client, and then de-tokenize it there is not Object Oriented Programming.
OOP would be one object for every conceptual object you need to work with, exposed to the JSP through an Action, and accessed in JSP with EL or OGNL tags…
i know the step seems huge, but it is worth doing…
Or you can stay with your antipattern, antediluvian technology and try to hack this problem, maybe for today you will end this software, but tomorrow you will have the same problems.
My 2 cents (as said, i was in your situation years ago… )