<P><BR>How can you check an address?</BR></P>
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jeya_Selliah
Posted On:   Thursday, February 21, 2002 08:36 AM

Suppose, If I visit www.jguru.com and later on if I goto faq page, then my address changes to www.jguru.com/faq. So, how can you check that user is visiting jguru's home page and the faq page...etc by using servlets?? This is what I have right now, but doesn't seems to be working. Also how can you check (by using servlets) that the user left a site and accessing a different site? For example: the user accesses www.jguru.com and then goes to www.yahoo.com. After the user left www.jguru's home page if you set the session to invalidate and if the user comes back to ww.jguru.com again will the user hs a new session? public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {    More>>


Suppose, If I visit www.jguru.com and later on if I goto faq page, then my address changes to www.jguru.com/faq. So, how can you check that user is visiting jguru's home page and the faq page...etc by using servlets?? This is what I have right now, but doesn't seems to be working.
Also how can you check (by using servlets) that the user left a site and accessing a different site? For example: the user accesses www.jguru.com and then goes to www.yahoo.com. After the user left www.jguru's home page if you set the session to invalidate and if the user comes back to ww.jguru.com again will the user hs a new session?


			
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

res.setContentType("text/html");
PrintWriter out = res.getWriter();

HttpSession session = req.getSession(true);

String acceptAgreement = req.getParameter("accept_agreement");

String scheme = req.getScheme();
String server = req.getServerName();
String port = "";
port += req.getServerPort();
String url = scheme+"://"+server+":"+port;
String pageName = "/acceptagreement.jsp";
url += pageName;


if ((acceptAgreement == null) && pageName.equals(req.getScheme()+"://"+req.getServerName()+":"+
req.getServerPort()+"/acceptagreement.jsp")) {
res.sendRedirect(req.getScheme()+"://"+req.getServerName()+":"+
req.getServerPort()+"/agreement.jsp");
}
   <<Less
About | Sitemap | Contact