Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have written sample web application with servlets and jsp. As per the below code the action url should be executed automatically according to the "onload". I have written this below code in one of my servlet, The below "onload" form hits the path in action only in Firefox and IE but not in Chrome(41.0.2272.74 beta-m (64-bit)).I have seen the link Chrome - is not working but i did not get proper idea, I have my below code in the end of servelt. there is nothing to execute after this code in the servlet.

 out.write("<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
");
    out.write("<html><body onload="alert('alert has been fired');document.forms[0].submit()">
");
    out.write("<form method="POST" action="" + actionUrl + "">
");
    out.write("<input type="hidden" name="resourcePath" value="" + callbackUrl + ""/>
");
    out.write("<input type="hidden" name="locale" value="" + locale + ""/>
");
    out.write("<input type="hidden" name="rspjRequest" value="" + true + ""/>
");
    out.write("</form>
</body>
</html>
");
    out.close();

Is there any reserved key words of chrome in the above action url?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
178 views
Welcome To Ask or Share your Answers For Others

1 Answer

After some investigation finally i got solution for my problem. I forgot to set the Content type for the response in the servlet.

response.setContentType("text/html; charset=UTF-8");

Chrome browser will display response in the form of html page by using above line.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...