0

Hi All,

I have developed a web application using jps. I have a user pages, which can be accessed after entering login credentials. If a user tries to go the a certain page directly without logging in, it directs to login page, this works perfectly in all browsers except mozilla.

I have created session in all pages and checking if session is null or not, but still the users goes directly without logging in into a page where login credentials required. This is a major problem in mozilla. How to overcome this problem. Any solution regarding this would be appreciated.

Thanks

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by pradeepktg
0

Can you post code on how you redirect?

Hi javaAddict,

This is how i redirect.

<%
try
{
String strSessionUser = session.getAttribute("regusername").toString();
}
catch(Exception e)
{
%>
<script>
adminhome.expmsg.value='Please login';
adminhome.action="index.jsp";
adminhome.submit();
</script>
<%
}
%>
0

Then try to see what is the value of regusername.

<%
String strSessionUser = session.getAttribute("regusername");
System.out.println("strSessionUser:"+strSessionUser );
if (strSessionUser == null) {
%>
  <jsp:forward page="index.jsp?expmsg=Please login" />
<%
}
<%

Maybe what you have in the catch doesn't execute the way you want it because each browser has small differences in the way they handle javascript. ...maybe

Instead of using javascript, you can use the RequestDispatcher class and write java code that redirects.

But most important check what is the value of strSessionUser when you think you should redirect

0

Hey Guys,

Thanks for your help. It works perfectly!!!

Hi javaAddict,

This is how i redirect.

<%
try
{
String strSessionUser = session.getAttribute("regusername").toString();
}
catch(Exception e)
{
%>
<script>
adminhome.expmsg.value='Please login';
adminhome.action="index.jsp";
adminhome.submit();
</script>
<%
}
%>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.