Skip to content Skip to sidebar Skip to footer

How To Show Page Only After Executing Java Codes In Jsp

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

Solution 1:

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... )

Post a Comment for "How To Show Page Only After Executing Java Codes In Jsp"