File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes a mozilla specific problem , after an js alert data not getting printed at client side. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "a mozilla specific problem , after an js alert data not getting printed at client side." Watch "a mozilla specific problem , after an js alert data not getting printed at client side." New topic
Author

a mozilla specific problem , after an js alert data not getting printed at client side.

tejas bhojak
Greenhorn

Joined: Oct 11, 2008
Posts: 8
I have a specific problem in mozilla

i have written a JSP page
and there i have an inline script where i print an alert
like:-

test.jsp


now i try to open this jsp page
i get the alert
but the data after the alert is not getting printed
there is no error on my server console
and there are no error on mozilla error console
and this issue is in Mozilla only, in IE it's fine!

can any one please explain me
(1) how javascript code are executed at client side when page is still not completely loaded.
(2)I have made an observation, while fetching data from database and printing it through a JSP.
I tried printing more than thousand rows from DB to the browser(the client side).
now when the content was getting printed at client side it was not in one go
i could actually see the data getting printed slowly on browser, and while data was getting printed at client side
the query on the server side was not completely executed it was still fetching data from database.
so i believe that servlet engine doest not wait for the java code to get completely executed, it will render the page as an when
it gets the data, so if web server takes time to fetch the data that delay will be reflected at client side,
and between all these delays we have and javascript alert!
so i am not able to visualise , what will happen if there is an alert , will web server stop fetching data till ok on alert is press
or server will fetch the data but wont print it until we press okay key!

please help, i am really confused about this javascript execution before the page is completely rendered at client side.
thanks in advance.

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

I made a page like this



This works fine for me. Also this forum is for JSP, please use the HTML-JavaScript forum for such questions...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
That's not possible. Java code runs on server, javascript functions on client.
tejas bhojak
Greenhorn

Joined: Oct 11, 2008
Posts: 8
Ankit you are rite
but in your case there is no rendering of page from an web server to client
what you are doing its on client side only.

in my case the data is getting rendered from web server(Jboss) to client(Mozilla).
and even if you code it in JSP that will work because its really fast for web server to generate static HTML.

i have a doubt , that what will happen if the page to be rendered on client is not completely ready,
and by observation i see that web server keeps on rendering the page as an when the static HTML is generated.

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

what will happen if there is an alert , will web server stop fetching data


As Eduardo said, the alert has nothing to do with the server side processing. Only the browser is concerned with that. The browser might not render anything unless you press ok but the server will keep sending the output...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
tejas bhojak
Greenhorn

Joined: Oct 11, 2008
Posts: 8
is it possible that web server has rendered the data to browser but because of some condition
or may be some bug in browser, its not printing the data.
This may be a rare scenario,
but is it possible?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

What does a View Source form the browser show you?
tejas bhojak
Greenhorn

Joined: Oct 11, 2008
Posts: 8
thats interesting , it does show me the HTML content.
view source is not blank!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Why was that not your first debugging step?

Is all of it there?

If the HTML is complete, and part of it is not being displayed, a good bet is that the HTML is invalid.
tejas bhojak
Greenhorn

Joined: Oct 11, 2008
Posts: 8
i've got one bug reported for mozilla.
webpage

I don't have any issue with the bug , if i delay the alert for some time
or if i change the location of alert to last page then the page is displayed properly
so i do have a work around.
but how all these things are happening , i am not able to digest .
Why mozilla wont print the page which is already fetched from web server?
 
wood burning stoves
 
subject: a mozilla specific problem , after an js alert data not getting printed at client side.