When a direct visitor comes to our site, we are unable to maintain cookies and session. For example, when visitor comes to our site for the first time, we get a null pointer exception. This is not happening when there is a return visitor to our site. Any idea why this could be happening?
Each page has a body tag. On loading the body tag, we don't get session values. We are getting only a null pointer exception (this is happening for a first time visitor only). When the same visitor comes back to our site, we are not getting a null pointer exception, and it seems to work fine.
<%Pattern p = Pattern.compile( "([0-9]*)" );
Matcher match=p.matcher(session.getAttribute("zip").toStri ng());
<body bgcolor="#778899" onload="change(),zipValid('<%=session.getAttribute ("zip").toString() %>')">
<body bgcolor="#778899" onload="change()">
Basically, whenever a visitor comes back to our site, we are trying to pre-fill the zip code field with the zip code they last searched with. If they are searching during the same session, then we are trying to pre-fill the zip code with which they searched previously.