Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set frame target in Servlet

 
Huaxing Wu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a JSP that is in a Frame that allows a user to login. If the user successfully logs in we want to replace the frameset with a new frameset, and if not successful we want to stay with the same frameset.
The JSP post a request to a servlet, and the servlet will determine if the user logged in or not. If the user logged in we need to set "target=_top", and if not successfully set "target=text". How do you do this in the servlet?
Thanks
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the only way I can think to do this doesnt have the servlet in the picture at all. Basically, if the servlet successfully logs the user in, it should return an HTML page that includes a javascript in it which checks if the current frame is the top one and reassigns the url for the top frame if not,
I think this goes something like:
if(self.url != top.url)
top.url = self.url
or something similar. I think you get the point. It sounds like the site needs rearchitecting though, I cant think of a reason to need to do what you are doing. The above solution would result in a double hit each tiem the user logs in, once to log in and return the appropriate page, and then a second time to return the page as a top level frame. On the other hand, this used to be quite common (despite the double hits at the beginning) to stop people leeching your site by having sites that were nothing but a two frame site with an advert in the first frame and someone elses site in the other.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic