File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes changing form's target attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "changing form Watch "changing form New topic
Author

changing form's target attribute

Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
Hello,
we have <form name="" action="" target="">
Is it possible to set / change the value of target attribute in my service method of the servlet, so that i can control when to open the output in a new window.
I have a situtation where i have to decide(whether to open a new window or display the result in same window) after retrieving request parameters. I am confused, plz help
thanks


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

servlet processing happens server-side, after the form has been submitted. The target has already been remembered by the browser, and the response the servlet sends back will appear either in the same window or a different one. This is up to the browser, and there is nothing your servlet can do about it.

One option is to use javascript in your original form to dynamically change the target attribute, based on what the user selects or enters. This would happen before the form is submitted.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: changing form's target attribute
 
Similar Threads
tracking url in jsp
Dynamic links
href in a new window
call by post
How to Open JSF Page in Separate Browser Window