How can I forward to an external URL from within a DataAction?

This is a very simple question I'd guess -- but what I thought was the obvious answer turned out not to be. Keep in mind I am using struts, and the URL is constructed dynamically, so I cannot place a struts forward action in the struts-config.xml file. Here is what I tried from within my DataAction's prepareModel() method:
actionContext.setActionForward(newURL);
actionContext.setRedirect(true);
This didn't work -- nothing happened. Anyone have any ideas?
Brad

In our application, we had a forward named Cancel, but for it to work properly we wanted a Redirect to occur to another page. The redirect was not working until we created a new actionforward and set th action forward to it as seen below. You can't programmatically change the forwards at runtime without error, from what I remember.
DataActionMapping mapping = ctx.getActionMapping();
ActionForward af = mapping.findForward("Cancel");
ActionForward afNew = new ActionForward();
afNew.setPath(ctx.getHttpServletRequest().getSession().getServletContext().getInitParameter("rootURL") + af.getPath());
afNew.setRedirect(true);
ctx.setActionForward(afNew);

Similar Messages

  • How to call Operating System commands / external programs from within APEX

    Hi,
    Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
    E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
    c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
    Any pointers will be greatly appreciated.
    Thanks & Regards,

    Hi Guys,
    I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
    However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
    sqlplusw.exe user/password@database @script1.sql
    sqlplusw.exe user/password@database @script2.sql
    sqlplusw.exe user/password@database @script3.sql
    sqlplusw.exe user/password@database @script4.sql
    What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
    Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
    Any help will be greatly appreciated.
    Thanks & Regards,

  • How can I forward to a Webflow URL in a portlet?

    I am trying to get a JSP in a portlet to forward to a Webflow URL,
    without much success...
    The following code produces the ubiquitous "Functionality temporarily
    unavailable" message, presumably because jsp:forward chokes on the
    absolute URL:
    <c:set var="url">
    <portlet:createWebflowURL event="next"/>
    </c:set>
    <%
    // convert to a scripting variable for the jsp:forward tag
    String url = (String) pageContext.getAttribute("url");
    %>
    <jsp:forward page="<%=url%>"/>
    Using c:redirect fares little better. This code produces an empty
    portlet:
    <c:set var="url">
    <portlet:createWebflowURL event="next"/>
    </c:set>
    <c:redirect url="${url}"/>
    The closest I've been able to get is to have the user click a link to
    get to the next page, but I'd like to have an automatic forward rather
    than introduce another mouse click:
    ">
    Click to continue...</A>
    Am I missing something obvious? Any help would be appreciated...
    Thanks,
    -- Craig

    Craig - I'm trying to do something very similar - build a waiting page into the
    flow. I've got a support case open (to get the BEA recommended approach) but so
    far have had no luck. Let me know if you've found the answer - or are still struggling.
    Cheers,
    Niall
    [email protected] (Craig Coffin) wrote:
    I am trying to get a JSP in a portlet to forward to a Webflow URL,
    without much success...
    The following code produces the ubiquitous "Functionality temporarily
    unavailable" message, presumably because jsp:forward chokes on the
    absolute URL:
    <c:set var="url">
    <portlet:createWebflowURL event="next"/>
    </c:set>
    <%
    // convert to a scripting variable for the jsp:forward tag
    String url = (String) pageContext.getAttribute("url");
    %>
    <jsp:forward page="<%=url%>"/>
    Using c:redirect fares little better. This code produces an empty
    portlet:
    <c:set var="url">
    <portlet:createWebflowURL event="next"/>
    </c:set>
    <c:redirect url="${url}"/>
    The closest I've been able to get is to have the user click a link to
    get to the next page, but I'd like to have an automatic forward rather
    than introduce another mouse click:
    ">
    Click to continue...</A>
    Am I missing something obvious? Any help would be appreciated...
    Thanks,
    -- Craig

  • How can I execute an IE browser window from within my java application?

    I am programming a java application that requires me to execute a browser application and point to a specific web site. How can I do this? I cannot seem to find any examples on the web.

    Hi Heals,
    This forum is for discussing Measurement Studio for Visual Basic and is not really a good place to ask general purpose Java questions. I suggest searching one of the comp.lang.java.* newsgroups at http://groups.google.com/.
    Off the top of my head, though, I would say take a look at the Runtime.exec method.
    - Elton

  • How can I write to a (external)file from a stored procedure

    I want to write some data to a (external) file. I have it working with the function UTL_FILE.
    My problem is I want to write to a file on a mapped drive (so a drive on a different machine). This is not working.
    Does anyone know a way to build this.
    Please send your responses to [email protected]
    Many thanks,
    Alex Nagtegaal

    an extraction out of expert one-on-one from Thomas Kyte
    <quote>
    when an oracle istance is created the services that support it are setup to 'log on as' the system (or operating system) account, this account has very few privileges and no acces to Window NT Domains. To access another Windows NT machine the OracleServiceXXXX must be setup to logon to the appropriate Windows NT Domain as a user who has acces to the required location for UTL_FILE.
    To change the default logon for the Oracle services go to (in Windows NT):
    Control Panel | Services | OracleServiceXXXX | startup | log on as; (where XXXX is the instance name)
    In Windows 2000, this would be:
    Control Panel | Administrative Tools | Services | OracleServiceXXX | Properties | Log on tab; (again XXXX is the instance name)
    Choose the This Account radio button, and then complete the appropriate domain login information. ONce the services have been setup as a user with the appropriate privileges, ther are two options dfor setting UTL_FILE_DIR:
    * Mapped Dirve: To use a mapped drive, the user that the service starts as must have setup a drive to match UTL_FILE_DIR and be logged onto the server when UTL_FILE is in use.
    * Universal Naming Convention: UNC is preferable to Mapped Drives because it does not require anyone to be logged on and utl_file_dir should be set to a name in the form \\<machine name>\<share name>\<path>
    You will of course need to stop and restart Oracle after changing the properties of the service.
    <\quote>
    I want to write some data to a (external) file. I have it working with the function UTL_FILE.
    My problem is I want to write to a file on a mapped drive (so a drive on a different machine). This is not working.
    Does anyone know a way to build this.
    Please send your responses to [email protected]
    Many thanks,
    Alex Nagtegaal

  • Is it possible to link out to external URLs from within an HTML widget, and have them open in Safari?

    I can add links within the iBook content, but if they're added inside an HTML widget, the new page loads *inside* the widget itself, with no ability to navigate back etc.
    Is there any way to have external links inside an HTML widget open in Safari?
    Thanks,
    Mike

    Those links need to be local the the book, sorry.
    As always, feel free to use the 'Provide iBooks Author Feedback' menu item for features you'd like added in the future, etc.
    http://www.apple.com/feedback/ibooks-author.html

  • How can I forward an e-mail document on adobe

    I want to know how can I forward a e-mail document from adobe and I saved the document called Princess Pink but cannot find it. two questions need answer

    Hi Ohtigers
    Is your document a PDF?
    Did you have it open in Reader or Acrobat Prod?
    Can you log into https://files.acrobat.com/ and search for your document?
    If your document is a PDF, you can open it in Adobe Reader and you can send the file using Adobe SendNow
    Select 'Tools' from the top bar
    In the right hand panel select 'Send Files'
    Click on  'Sign In' - you will be prompeted to enter your Adobe ID and password
    Enter an email address into the To field
    Option: Fille out the Subject and Message fields
    Select Send Link button

  • Navigate to external URL from secured APEX server

    NOTE I am using the internal Oracle APEX server to host my application, so it may be possible that you will have to be an Oracle employee with the same access, or using a similar setup, in order to respond. Even if you are not, if you feel inclined to "take a swing" at it, keep this in mind.
    Hi all,
    I am using the internal APEX server at oracle to host an application (Application Express 4.0.2.00.07). I have other, NON-APEX applications hosted on other servers within the Oracle firewall.
    On page 0 of the APEX application (which, as you may know, usually displays as the "header" section of every other page in the application) I have created a select list of the other projects and their associated URLs as well as a "Go" button, so users that want to navigate to the other applications can do so from this application. Since page 0 does not seem to allow the creation of standard branch items (please correct me otherwise), I have created a process on that page triggered by the "Go" button. The process currently contains the following code:
    begin
    apex_application.g_unrecoverable_error := true;
    htp.p('<script language="JavaScript">
    window.open (:P0_PRODUCT_PAGES); <!-- :P0_PRODUCT_PAGES being the URL of the selected non-APEX application -->
    </script>');
    end;
    That code currently replaces the existing page with a blank page and the associated URL is "https://apex.oraclecorp.com/pls/apex/wwv_flow.accept". I am assuming this means that APEX was looking for an application ID and/or page and did not get it so it "stopped" at this page.
    I am unaware if there are any settings on the APEX server, DB,or associated web server preventing me from navigating outside of APEX once I am running the hosted application.
    I would like to launch another properly-sized (default) browser window rather than replace the existing window pointing to the URL for the selected application.
    I have also tried using the owa.util code to try to generate the proper URL but was likewise unsuccessful.
    NOTE: I am not looking for different ways to do this by changing server parameters, settings, etc. since I do not have server rights to do this. Additionally, due to time constraints, I would prefer not to be drawn in to a discussion of the comparisons and/or benefits of owa.util or javascript over the other for navigating to an external URL from within APEX, etc. (I'm not trying to be a "punk", but I AM under the gun to resolve this with very limited time). In light of this, please indicate if you have a working option to do this under similar conditions that I can implement quickly. I have done much research within the forums and Googled extensively for information from outside sources but have not yet found something that will provide the proper results.
    If you are an oracle employee and wish to contact me directly, please email me at [email protected]
    Crossing my fingers and hoping someone has done this before.
    Many thanks in advance; your useful contribution will actually contribute to lessening the world's INSOMINA factor considerably (mostly mine). ;)

    >
    I would like to launch another properly-sized (default) browser window rather than replace the existing window pointing to the URL for the selected application.
    I have also tried using the owa.util code to try to generate the proper URL but was likewise unsuccessful.
    >
    Opening a URL in a new tab or window has to happen in the browser, without submitting the page. The server doesn't know about browser windows. Use:
    onchange="window.open(this.value);" in the HTML Form Element Attributes property of <tt>P0_PRODUCT_PAGES</tt> (making the "Go" button unnecessary), or, if the "Go" button is required to match the LAF:
    onclick="window.open($v('P0_PRODUCT_PAGES'));"in the button Attributes property, ensuring the button is a template button including the <tt>#BUTTON_ATTRIBUTES#</tt> substitution string, e.g.
    <input type="button" value="#LABEL#" #BUTTON_ATTRIBUTES# />Ensure that absolute URLs are used in the <tt>P0_PRODUCT_PAGES</tt> where necessary, specifying the correct scheme for the site, so that you are not trying to go to <tt>{noformat}https://apex.oraclecorp.com/pls/apex/www.google.com{noformat}</tt> for example:
    f?FOO:BAR:&APP_SESSION.    // other APEX app hosted on apex.oraclecorp.com sharing the same authentication scheme
    https://foo.oraclecorp.com // other secured internal site
    http://www.google.com      // unsecured external site

  • How can I forward to a jsp under the WEB-INF directory?

    I have a webapp with a jsp that forwards to a jsp called /WEB-INF/pages/secure.jsp When I try to forward to it, I get the error:
    "trying to GET /mywebapp/WEB-INF/pages/secure.jsp, deny-existence reports: denying existence of /web/webapps/mywebapp/WEB-INF/pages/secure.jsp"
    How can I forward to this page?
    Thanks,
    Micah

    Craig - I'm trying to do something very similar - build a waiting page into the
    flow. I've got a support case open (to get the BEA recommended approach) but so
    far have had no luck. Let me know if you've found the answer - or are still struggling.
    Cheers,
    Niall
    [email protected] (Craig Coffin) wrote:
    I am trying to get a JSP in a portlet to forward to a Webflow URL,
    without much success...
    The following code produces the ubiquitous "Functionality temporarily
    unavailable" message, presumably because jsp:forward chokes on the
    absolute URL:
    <c:set var="url">
    <portlet:createWebflowURL event="next"/>
    </c:set>
    <%
    // convert to a scripting variable for the jsp:forward tag
    String url = (String) pageContext.getAttribute("url");
    %>
    <jsp:forward page="<%=url%>"/>
    Using c:redirect fares little better. This code produces an empty
    portlet:
    <c:set var="url">
    <portlet:createWebflowURL event="next"/>
    </c:set>
    <c:redirect url="${url}"/>
    The closest I've been able to get is to have the user click a link to
    get to the next page, but I'd like to have an automatic forward rather
    than introduce another mouse click:
    ">
    Click to continue...</A>
    Am I missing something obvious? Any help would be appreciated...
    Thanks,
    -- Craig

  • On AOL, how can I forward an e-mail using my contacts

    I am no longer using AOL's web site, but was told to get to AOL thru Firefox. How can I forward my e-mails? When I hit "forward" the e-mail appears, but when I hit my "contacts, (so I can insert e-mail addresses) the e-mail is gone and now is in "old" mail

    Hi Ohtigers
    Is your document a PDF?
    Did you have it open in Reader or Acrobat Prod?
    Can you log into https://files.acrobat.com/ and search for your document?
    If your document is a PDF, you can open it in Adobe Reader and you can send the file using Adobe SendNow
    Select 'Tools' from the top bar
    In the right hand panel select 'Send Files'
    Click on  'Sign In' - you will be prompeted to enter your Adobe ID and password
    Enter an email address into the To field
    Option: Fille out the Subject and Message fields
    Select Send Link button

  • I am using earphones, but the external audio of my mini ipad is still on. How can I turn off the external audio while listening with my headset?

    I am using earphones, but the external audio of my mini ipad is still on. How can I turn off the external audio while listening with my headset/earphones?

    Other than iMovie, GB always incorporates the audio files into the GB package. So just save or move the GB project to the external drive, and you're done - anything you import, edit or record will be saved to the external drive.

  • How can I forward a mail to multiple mail accounts that I have in a group without having to add them one by one?

    How can I forward a mail to multiple mail accounts that I have in a group without having to add them one by one?

    I don't think that you can. Yahoo's basic email features do not include mail forwarding.

  • How can I set up an external monitor to extend my screen in windows 7 bootcamp?

    How can I set up an external monitor to extend my screen in windows 7 bootcamp?  I have updated bootcamp to the latest version.  The monitor I have works while I am using Mac OS X. While in bootcamp the monitor is dectected and I am able to select the settings and displays however the external monitor remains alseep.  I hooked it up using a mini display port to VGA adapter.  Any suggestions?
    Thanks

    On your Windows desktop right click and select Screen resolution from the menu. You should see a window like this:
    Make sure you select Extend and then set your resolutions for each monitor.
    If this does not work for you try asking on a Windows forum about extending displays to a second monitor.

  • How can I copy and paste a URL address?

    How can I copy and paste a URL address?

    Do you use chrome? Just double tap on the link and you will get the cut/copy options.
    All we have to decide is what to do with the time that is given to us - J.R.R. Tolkien

  • How can my iMac support 2560x1080 external monitor (LG 29EA93)

    How can my iMac support 2560x1080 external monitor (LG 29EA93)?
    Please, help on this issue?
    iMac 2012 Late
    NVIDIA GeForce GT 640M 512MB
    OS X 10.8.5 (12F37)

    Thanks for your prompt  answer.   
    I still have problems and I don't know why.

Maybe you are looking for