New Window from a Servlet

Hello All,
How can I make a servlet open a new browser window (or a pop-up window) at the client end with an html form in it?
Thanks a lot in advance,
RookieServletPrgmer

Servlets don't open new windows. You could generate some HTML + javascript content that does it. And that means your question is a html + javascript one.
Opening a new window: create a link with the attribute target="_new"Opening a new tab: create a link with the attribute target="_blank"Opening a popup: use the javascript window.open function
But note that most users have a popup blocker installed nowadays; popups are very much frowned upon.

Similar Messages

  • Create or open a new browser from a servlet

    Hi everybody(sorry my english is so terrible), i have one problem .It`s possible to create ,instance or open a new browser from a servlet without javascript?.

    Hi everybody(sorry my english is so terrible), i have
    one problem .It`s possible to create ,instance or
    open a new browser from a servlet without javascript?.Well, sorta. You have to create a link with a target to "_blank" that the user clicks on. For example:
    Some Page
    will open somePage.jsp in a new browser window. There would be no way, other then js to do it automatically (and often those are blocked, now-a-days with pop-up blockers), flash (can be blocked as well, requires a plugin to use, costs money to get the developement kit), or an applet (java program embeded in web page, requires a plugin, can be blocked). Or some other client-side script/application. (ie servlets run on the server so they can't interact with the client's computer. You need something on the client's computer to do the job).

  • Is there a way to open a new window from the "Go" menu in Mavericks?

    Before Mavericks, I was able to go from the Finder to the top menu "Go" -> "Utilities", or Applications or Home… and a new window would open.
    Now I have to manually open a new window to avoid loosing my existing window.
    Is there a way to open a new window from the "Go" menu?

    Before Mavericks, I was able to go from the Finder to the top menu "Go" -> "Utilities", or Applications or Home… and a new window would open.
    Now I have to manually open a new window to avoid loosing my existing window.
    Is there a way to open a new window from the "Go" menu?
    First, as others have already stated.....make sure the checkbox is deselected for "open folders in tabs instead of windows" in Finder Preferences.
    If you're like me and don't like tabs very much, there is a way to make folders always open in windows with a simple click (I'm using Mavericks 10.9.5).  Go to a root folder (for example, the Documents Folder), open it, and select View > Hide Toolbar, then all folders within that root folder will open in a new window.
    As an alternative method, any folder can be opened in a new window by holding down either Command Key while clicking the folder. But sooner or later you will forget to hold down that key, and then clicking on a folder will open in a tab (which will automatically resize the window and cause much aggravation).
    The Hide Toolbar trick will also work with any folder present on the Desktop. It will make all folders inside that folder open in new windows.
    To make the Applications Folder open in a new window when opening it from the menu bar at the top of the screen, you will have to open the main hard drive folder and use the Hide Toolbar trick. This will cause all folders inside it to open in new windows.
    Hope this helps.

  • Open iviews in new window from detailed navigation context menu function

    hello,
    when we click in the detail navigation menu and in the context menu (because many of ours users are used to right click to open a link in a new window on the internet) on the functionnality "open in new window", the start page is always display instead of the corresponding iview ...
    could you tell me if there is a configuration into the portal to :
    1- suppress the function "open in new window" from the context menu in the detailed navigation !
    2- make the iview displayed into the new window really the iview desired !
    best regards,
    Olivier.

    Hi Olivier,
    The frist part is very precise. Not possible. Period. The reason is that the links are calling JS and not directly calling a http target.
    About the second part: Within the Light Framework, you create a Light Detailed Navigation. And in this case, the links are direct http links. So with that, you have what you want.
    For the Light Framework see http://help.sap.com/saphelp_nwce10/helpdata/en/43/0174a642406db7e10000000a422035/frameset.htm and around.
    Hope it helps
    Detlev

  • How can I get a query in the search field to open in a new tab or new window from the current window?

    How can I get a query in the search field to open in a new tab or new window from the current window?

    If you are searching via the Search Bar on the Navigation Toolbar, this preference can be changed to have searches there open in a Tab.
    Type '''about:config''' in the Address Bar and hit Enter. Then answer "I'll be careful". Type this pref in the Search at the top.
    '''browser.search.openintab''' = double-click to toggle to '''true'''

  • How to open a new window from the login window?

    hi,
    can someone tell me how to open a new window from an existing window, here by window i mean frame. The case is i hv two java files - oracle.java and FDoptions.java. The first frame is in the Login.java. The oracle.java file has a button "Login", when it is clicked, i want to open the next frame which is in the file FDoptions.java. Can some one help me with this? I m giving the code below -
    oracle.java
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    * The application's main frame.
    public class oracle {
        private JFrame frame;
        private JPanel logInPanel;
        private JButton clearButton;
        private JButton logInButton;
        private JButton newuserButton;
        private JButton forgotpasswordButton;
        private JTextField userNameTextField;
        private JPasswordField passwordTextField;
        public oracle() {
            initComponents();
        private final void initComponents() {
            JLabel userNameLabel = new JLabel("User name: ");
            JLabel passwordLabel = new JLabel("Password: ");
            userNameTextField = new JTextField();
            passwordTextField = new JPasswordField();
            JPanel userInputPanel = new JPanel(new GridLayout(2, 2, 5, 5));
            userInputPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20));
            userInputPanel.add(userNameLabel);
            userInputPanel.add(userNameTextField);
            userInputPanel.add(passwordLabel);
            userInputPanel.add(passwordTextField);
            logInButton = new JButton(new LogInAction());
            clearButton = new JButton(new ClearAction());
            newuserButton = new JButton(new NewUserAction());
            forgotpasswordButton = new JButton(new ForgotPassword());
            JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            JPanel buttonPanel1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
            buttonPanel.add(logInButton);
            buttonPanel.add(clearButton);
            buttonPanel1.add(newuserButton);
            buttonPanel1.add(forgotpasswordButton);
            logInPanel = new JPanel(new BorderLayout());
            logInPanel.add(userInputPanel, BorderLayout.NORTH);
            logInPanel.add(buttonPanel, BorderLayout.CENTER);
            logInPanel.add(buttonPanel1,BorderLayout.SOUTH);
            frame = new JFrame("FD Tracker");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(500, 500);
            frame.setContentPane(logInPanel);
            frame.pack();
            frame.setVisible(true);
        private void performLogIn() {
            // Log in the user
            System.out.println("Username: " + userNameTextField.getText());
            char[] password = passwordTextField.getPassword();
            System.out.print("Password: ");
            for(char c : password) {
                System.out.print(c);
            System.out.println();
        private void performClear() {
            // Clear the panel
            System.out.println("Clearing the panel");
            userNameTextField.setText("");
            passwordTextField.setText("");
        private final class LogInAction extends AbstractAction {
            public LogInAction() {
                super("Log in");
            @Override
            public void actionPerformed(ActionEvent e) {
                performLogIn();
        private final class ClearAction extends AbstractAction {
            public ClearAction() {
                super("Clear");
            @Override
            public void actionPerformed(ActionEvent e) {
                performClear();
        private final class NewUserAction extends AbstractAction{
             public NewUserAction(){
                 super("New User");
             @Override
             public void actionPerformed(ActionEvent e){
                 JFrame newuser = new JFrame("NewUser");
        private final class ForgotPassword extends AbstractAction{
            public ForgotPassword(){
                super("Forgot Password");
            @Override
            public void actionPerformed(ActionEvent e){
                JFrame forgotpassword = new JFrame("Forgot Password");
        public static void main(String args[]) {
            new oracle();
         FDoptions.java
    import java.awt.FlowLayout;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class Fdoptions{
        private JFrame fdoptions;
        private JPanel fdoptpanel;
        private JButton enterfdbutton;
        private JButton viewfdbutton;
        public Fdoptions() {
            initComponents();
        private final void initComponents(){
            fdoptpanel = new JPanel(new BorderLayout());
            fdoptpanel.setBorder(BorderFactory.createEmptyBorder(80,50,80,50));
            enterfdbutton = new JButton(new EnterFDAction());
            viewfdbutton = new JButton(new ViewFDAction());
           JPanel enterbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
           JPanel viewbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            enterbuttonpanel.add(enterfdbutton);
            viewbuttonpanel.add(viewfdbutton);
            fdoptpanel.add(enterbuttonpanel,BorderLayout.NORTH);
            fdoptpanel.add(viewbuttonpanel,BorderLayout.SOUTH);
            fdoptions = new JFrame("FD Options");
            fdoptions.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            fdoptions.setSize(1000,1000);
            fdoptions.setContentPane(fdoptpanel);
            fdoptions.pack();
            fdoptions.setVisible(true);
        private void performEnter(){
        private void performView(){
        private final class EnterFDAction extends AbstractAction{
            public EnterFDAction(){
                super("Enter new FD");
            public void actionPerformed(ActionEvent e){
                performEnter();
        private final class ViewFDAction extends AbstractAction{
            public ViewFDAction(){
                super("View an existing FD");
            public void actionPerformed(ActionEvent e){
                performView();
        public static void main(String args[]){
            new Fdoptions();
    }

    nice day,
    these lines..., despite the fact that this example is about something else, shows you two ways
    1/ modal JDialog
    2/ two JFrame
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * Parent Modal Dialog. When in modal mode, this dialog
    * will block inputs to the "parent Window" but will
    * allow events to other components
    * @see javax.swing.JDialog
    public class PMDialog extends JDialog {
        private static final long serialVersionUID = 1L;
        protected boolean modal = false;
        private WindowAdapter parentWindowListener;
        private Window owner;
        private JFrame blockedFrame = new JFrame("No blocked frame");
        private JFrame noBlockedFrame = new JFrame("Blocked Frame");
        public PMDialog() {
            noBlockedFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            noBlockedFrame.getContentPane().add(new JButton(new AbstractAction("Test button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    System.out.println("Non blocked button pushed");
                    blockedFrame.setVisible(true);
                    noBlockedFrame.setVisible(false);
            noBlockedFrame.setSize(200, 200);
            noBlockedFrame.setVisible(true);
            blockedFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
            blockedFrame.getContentPane().add(new JButton(new AbstractAction("Test Button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    final PMDialog pmd = new PMDialog(blockedFrame, "Partial Modal Dialog", true);
                    pmd.setSize(200, 100);
                    pmd.setLocationRelativeTo(blockedFrame);
                    pmd.getContentPane().add(new JButton(new AbstractAction("Test button") {
                        private static final long serialVersionUID = 1L;
                        @Override
                        public void actionPerformed(ActionEvent evt) {
                            System.out.println("Blocked button pushed");
                            pmd.setVisible(false);
                            blockedFrame.setVisible(false);
                            noBlockedFrame.setVisible(true);
                    pmd.setVisible(true);
                    System.out.println("Returned from Dialog");
            blockedFrame.setSize(200, 200);
            blockedFrame.setLocation(300, 0);
            blockedFrame.setVisible(false);
        public PMDialog(Dialog parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        public PMDialog(Frame parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        private void initDialog(Window parent, String title, boolean isModal) {
            owner = parent;
            modal = isModal;
            parentWindowListener = new WindowAdapter() {
                @Override
                public void windowActivated(WindowEvent e) {
                    if (isVisible()) {
                        System.out.println("Dialog.getFocusBack()");
                        getFocusBack();
        private void getFocusBack() {
            Toolkit.getDefaultToolkit().beep();
            super.setVisible(false);
            super.pack();
            super.setLocationRelativeTo(owner);
            super.setVisible(true);
            //super.toFront();
        @Override
        public void dispose() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.dispose();
        @Override
        @SuppressWarnings("deprecation")
        public void hide() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.hide();
        @Override
        public void setVisible(boolean visible) {
            boolean blockParent = (visible && modal);
            owner.setEnabled(!blockParent);
            owner.setFocusableWindowState(!blockParent);
            super.setVisible(visible);
            if (blockParent) {
                System.out.println("Adding listener to parent ...");
                owner.addWindowListener(parentWindowListener);
                try {
                    if (SwingUtilities.isEventDispatchThread()) {
                        System.out.println("EventDispatchThread");
                        EventQueue theQueue = getToolkit().getSystemEventQueue();
                        while (isVisible()) {
                            AWTEvent event = theQueue.getNextEvent();
                            Object src = event.getSource();
                            if (event instanceof ActiveEvent) {
                                ((ActiveEvent) event).dispatch();
                            } else if (src instanceof Component) {
                                ((Component) src).dispatchEvent(event);
                    } else {
                        System.out.println("OUTSIDE EventDispatchThread");
                        synchronized (getTreeLock()) {
                            while (isVisible()) {
                                try {
                                    getTreeLock().wait();
                                } catch (InterruptedException e) {
                                    break;
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("Error from EDT ... : " + ex);
            } else {
                System.out.println("Removing listener from parent ...");
                owner.removeWindowListener(parentWindowListener);
                owner.setEnabled(true);
                owner.setFocusableWindowState(true);
        @Override
        public void setModal(boolean modal) {
            this.modal = modal;
        public static void main(String args[]) {
            new PMDialog();
    }

  • "open in new window"- from favorites panel - bridge

    Hi Bridge, I love your way of working
    However 2 things make my hair rise
    - I can't "open in new window" from a favorited location. only in the "content" panel... which is rather "weird"
    - I have to "reveal in finder" to be able to zip/rar files.
    Please fix this, I know i am not the only one who would love this.

    - I can't "open in new window" from a favorited location. only in the "content" panel... which is rather "weird"
    To be honest, I never thought about that option, I always use the shortcut cmd + N for a new window and point to a folder in either folder panel or favorites panel. There is always something to learn
    Having the same option in Favorites as in Folder panel would be very logical indeed!
    - I have to "reveal in finder" to be able to zip/rar files.
    I think you are bound to do so always because Bridge is in fact a browser and in itself not capable of editing files. The export panel did some tasks with resizing but has been discontinued in CC.
    Only if Adobe made an application to unzip or open other packages the possibility for using the tools menu and reach the start up script for such app would be the shortest road possible to my knowledge. But also AFAIK Adobe does not offer such application.
    And using MacOsX 10.8.4 my downloaded zip files are unzipping themselves automatically...
    Please fix this, I know i am not the only one who would love this.
    This won't work because this is a user to user forum, use the feature request option here:
    http://feedback.photoshop.com/photoshop_family/

  • Open a URL in a new window from Flash

    Looking for the simplest way to open a URL in a new window from Flash using AS3-CS3, Thank you.

    The following line of code will do that...fill in the URL
    navigateToURL(new URLREquest("http://www....", "_blank"));

  • Close a browser  window from a servlet

    I am newbie and am trying to close the browser window from my servlet without prompting as my servlet is designed to run as a batch app.
    The servlet is invoked by a scheduling agent and performs the batch function , but leaves the browser window open . I
    need help
    Thanks
    VK

    I am newbie and am trying to close the browser
    window from my servlet without prompting as my
    servlet is designed to run as a batch app.
    The servlet is invoked by a scheduling agent and
    performs the batch function , but leaves the browser
    window open .I don't see the problem with that. The users can easily close the browser if they want to. It's possible that some Javascript could be used to close the browser window but it's user-unfriendly and shouldn't normally be done.

  • I cannot open a new browser window by double clicking Firefox icon or selecting NEW WINDOW from the file menu.

    I can open only 1 browser window and I can't open another or multiple windows by double clicking Firefox icon or selecting NEW WINDOW from the file menu.
    Looking forward to your earliest reply.
    Thanks and regards,
    Sheraz

    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • Starting new threads from a servlet

    Hi
    I read somewhere that starting new threads from a servlet is not supported in the future releases of J2EE .
    Any one aware of this.
    I have a listener program started as a new thread from the init method of a servlet which is set to load on startup.
    I have to think about another way to do this if this is not suppported in the future releases
    any comments

    Dr clap
    Actually I was getting some warning messages in my websphere server console when I tried to make JDBC connections from the thread I opened in the servlet.
    Everthing works fine but with the warning messages,
    Then someone from IBM answered me in one of the forums quote
    Cause: These messages are being produced due to an
    "unsupported" environment. When application is
    spinning its own threads from an EJB, spinning a
    thread and accessing a database is not supported (per
    the J2EE specification). One exception to this rule is
    if a Servlet is spinning its own threads and accessing
    a database. The J2EE specification is not clear on
    this, so WebSphere Application Server 5.0 must allow
    for it at this time. IBM is working with Sun to
    clarify this in the specification, so eventually (i.e.
    J2EE 1.4) spun threads from a Servlet accessing a
    database outside of a transaction will not be
    supported either.
    Since we don't want to promote the usage of these
    "naked" threads accessing databases, we are producing
    the warning messages. Although they may be filling up
    the logs, we feel that these are necessary to warn the
    user that they are doing something not in-line with
    the intended usage. Customer should consider changing
    their application to comply with the
    J2EE specification.
    """

  • When I open a new windows from my current tab background turns black. Can this be disabled?

    I use Remedy and when I open a new windows from my current one my background turns black. This started when I moved to the new update. Is there anyway to disable this?

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How can I open new window from a link in another window?

    Hello everyone!
    Can anyone help me with my problem. I need to open a child window from a link in the mother/master window. Actually, the link that would open the child window is directed to a servlet that retrieves data from the database. The data will then be displayed in the child window. I don't how to open a new window with the data retrieve (thru the servlet) displayed in it. I'm using model 2 architecture (Servlet-JSP).
    Thank you in advance and more power!
    nicoleangelisdaddy
    [email protected]

    Or you can use something like this,
    Click and in your test()
    <script language="javascript">function test()
          document.form_name.target="_blank";
          document.form_name.action="/test/servlet/LoginServlet";
          document.form_name.method="post"
          document.form_name.submit();
    }</script>
    Here "/test" is your application context path.
    If you want to open the link in the named window then use,
    document.form_name.target="your_own_name";

  • How to open a new window from submit button &dialog page in current window?

    We have a requirement, wherein we have a OAF search page for PO lines with search criteria, Go button to search ,result region (table layout) and a submit button(Create new expedite).
    1. Now user can select some lines from result region and click on Submit button.
    2. On click of submit button we need to pop up a window or may be a dialog page asking that " Do you want open supplier web link portal or not?".
    3. If user clicks yes(in Dialog page) then first fetch the URL from a look up maintained in Oracle EBS on the basis of supplier of the lines selected and then open that URL in a new window and side by side we need to open a dialog page in search page asking "whether user has updated the expedite info in supplier portal or not?". On basis of this we need to updated some count in custom tables.
    So in step 3 i am facing problem, that how to open an URL in a new window through a submit button and side by side want to open a dialog page in the current window also.
    Hope a quick response from you all.
    Note:- To open a custom page we can have a link or button(button of type button and not submit button) on base page with destination url property as following javascript:
    javascript:var a = window.open('OA.jsp?page=/XXX/oracle/apps/xxx/......&retainAM=Y', 'a','height=500,width=900,status=yes,toolbar=no,menubar=no,location=no'); a.focus();
    So the question is how to do the same for submit button on OAF page???

    Antriksh,
    You just need to attach a submit action in button bean and not submit button bean, based on the output of confirm type of alert in javascript.
    Here is code u need to put in destination url of the button:
    //replace <confirm message> by message you want to show.
    javascript:input=confirm('<confirm message>');if(input==true){submitForm('DefaultFormName',0,{XXX:' abc'});}" Now in the process request of the base page CO, u can get parametre 'XXX' from the pagecontext....so
    if((("abc").equals(pageContext.getParameter("XXX"))))
    {/// custom LOGIC }
    The same i have replied in your mail. I hope this resolves the issue.
    --Mukul

  • Firefox 29.0 opens new windows from clicking links that are in a smaller window, should open as maximized window. How to change?

    How do I click a link on a web page, and not have to maximize the window every time? Firefox 29 seemed to add this additional click annoyance and I can't see how to change that. I do not want full screen mode which is what Firefox calls it when it removes an additional row of menu items. I mean maximizing the window so I don't have to do it each time! Please tell me how to change the settings and restore this normal feature.

    Go to
    About:Config
    Change
    browser.link.open_newwindow
    value from 2 to 1
    Works for me now. Every new window is max size

Maybe you are looking for

  • Issue in standard LOV after extending the VO

    Hello All, My requirement is to restrict the LOV "Payment Document" of standard page "PsrPG.xml". Path of the page :- oracle.apps.ap.payments.psr.webui I have extended the VO and implemented my logic to fulfill the requirement. Its working fine if I

  • How to run a silent configuration for Forms and Reports 11g ?

    Hi all, I've run a silent installation for Oracle Forms and Reports 11g R2 in Windows 7 64 bit. I made it using a response file called install_only.rsp. Now I want to run the configuration also in silent mode. How can I do it ? I know that I can use

  • Excise Duty +Vat + CST in PO

    Dear All, As per my client requirement they need EXCISE DUTY , VAT & CST should come in the PO The Excise duty like 4.12% ,8.24%,14.42 etc ,(Set off & Non set off) Vat  :-    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20% Cst  :-     2,3,4,5,...

  • Btach split should not be considered in billing

    Hi all, 1).I've created a sales order for 20 kgs. 2). Created delivery 10 kgs from one batch and 10 kg from another batch 3). i need to create invoice in a single line for 20 KGs without considering the batch split. In vov7 for the item category Tan

  • Why won't page stay active?

    Whenever I have to restart Firefox, the top bar (with the red, yellow, green circles) keeps going all gray and I have to click on the page to activate it again. Takes a LONG time before I do something that makes it stay highlighted....but I don't kno