Am hitting a JSP page. In this JSP page, I have Jquery + Scriplets + some JSP tags (div, input, form etc) + Java Scripts.
This JSP page takes username as input from user. If user has not input his username but simply hits submit button the page will refresh and throw an error message. The page will refresh and hit the same URL (Error message is not shown in a new page)
In the process of user hitting Submit button and error message is thrown, Chrome Browser is also rendering other DIV elements in the JSP page for a flash of second and throwing the desired error message to user.
With Chrome browser rendering other elements (div, input etc) in the JSP when the same page is hit, it will give a picture of the other elements to users. This is not happening in IE and FF.
How to avoid this in Chrome?
@Alfasin:
I have attached the JSP code below. Let me know if any other details are required.
<html>
<head>
<script type="text/javascript" src="/static-files/scripts/jquery-1.6.2.js"></script>
<script type="text/javascript" src="/static-files/scripts/tooltip.js"></script>
<script type="text/javascript" src="/static-files/scripts/jquery-ui.min.js"></script>
<link href="/static-files/css/jquery-ui-rev.css" type="text/css" rel="stylesheet"/>
<%@page import="javax.servlet.http.Cookie"%>
<%
String visitingCookie = "AUTHCookie";
String urlCookie = "URLCookie";
String movieCookieName="movieCookie";
String displayOnlyPwd = "false";
Cookie[] cookielist = request.getCookies();
if(cookielist != null)
{
for(int i = 0; i<cookielist.length; i++)
{
Cookie cookie = cookielist[i];
if(cookie.getName().contains(visitingCookie) &&
!cookie.getValue().equals(""))
{
displayOnlyPwd = "true";
request.setAttribute("AUTHCookie",cookie.getValue());
request.setAttribute("displayOnlyPwd",displayOnlyPwd);
break;
}
}
if(displayOnlyPwd.contains("false"))
{
request.setAttribute("displayOnlyPwd",displayOnlyPwd);
}
}
else{
displayOnlyPwd = "false";
request.setAttribute("displayOnlyPwd",displayOnlyPwd);
}
%>
<script type="text/javascript">
$(function() {
$("#toopt a").tooltip({
bodyHandler: function() {
return $($(this).attr("href")).html();
},
});
});
function delete_cookie ( cookie_name )
{
var cookie_date = new Date ( );
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
function checkpassword()
{
var checkPassword=document.getElementById("password").value;
var counter=0;
var errMsg=" ";
var errMsg1=" ";
if(checkPassword.length==0)
{
errMsg+="Please enter a valid Password.";
document.writeln("<form name=\"errForm\" method=\"POST\" action=\"http://myDomain/web/portal/home/-/portal/login?_58_redirect=%2Fweb%2Fportal%2Flogout\">");
document.writeln("<input type=\"hidden\" name=\"errMsg\" value=\"" + errMsg + "\">");
document.writeln("</form>");
document.errForm.submit();
return false;
}
}
function enableDisableForm(myVar)
{
if(myVar == "true")
{
$(document).ready(function()
{
$("#disableDivForm").dialog({
autoOpen:true,
position:'center',
height:167,
width: 472,
modal: true
});
});
var div1 = document.getElementById("enableDivForm");
div1.style.display = "none";
}
else
{
var div2 = document.getElementById("disableDivForm");
div2.style.display = "none";
}
}
</script>
</head>
I have pasted 50% of my code here. Another 50% to go. Do you require me to paste full code?
Regards,
upload the body with the attribute:
"style= display: none;"and only after you’ve done with uploading the page (as the last command in ready function if you’re using jQuery) do: