Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getRequestDespatcher() to open in another frame??

 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Is there a way to open up a servlet/jsp/html in another frame using getRequestDespatcher()?? I have to open up a html page from a servlet (which is inside a frame) using getRequestDespatcher().
Please help out.
Regards,
Vijay
 
Mahesh Rana
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why dont you set the
target parameter to "new" in the calling HTML ?
That is simple.
 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Deep Narsay,
But where should I set the target parameter ?
Regards,
Vijay
 
Mahesh Rana
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay,
If you are calling this servlet via HREF then
<a href=myServlet target=new>Hi</a>
If you are calling thr' a form then syntax would be
<form action=myServlet
target="new"
method=post
>
....
...
<form>
Is that what you want ?
Regards.
 
Mahesh Rana
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want it in another frame (not a new window, )
set target to parent.frames['your another frame']
 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deep Narsay,
It seems I am not able to explain the problem I am sorry for this.
I am using getRequestDespatcher() method to forward request to an html page (login page), but I want to open this html page in another frame (not in the same frame as the servlet).
My page is divided in 2 frames , upper part contains an applet which calls the servlet, if servlet is not able to retrieve the session for the user it forward the request to login.html but because its applet which is calling the servlet ( and I donot have source code for applet) I cannot pass the target parameter to servlet while calling it.
I need a method to open the login.html in 2nd frame.
Thanks for replying.
Regards,
Vijay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic