Code after redirect (or forward)

Suppose that I redirect from a servlet to a jsp and I want that some code of the servlet is executed after the jsp presentation, how can I do this?
response.sendRedirect("/jsp/onejsp.jsp");
code_to_execute_after_jsp_presentation();
The problem is that the jsp is called after all the code of the servlet is executed.
There is a solution to this problem?
Thanks
Luciano

Hi,
I saw several of your messages that talk about "sendRedirect". I have the same problem. I have 2 JSP pages, but they are in two different location (JVM). I would like to send some session Attributes (using session.setAttribute from source JSP) to the target JSP. Therefore it can be read as session attribute also it will not show user what is the Parameter and details (if you send Parameter using "?CustomerID=<%= CustomerID %>" then user can see the info by viewing the source).
If you know the answer already, can you let me know?

Similar Messages

  • Print statement in JSP page after redirection

    Hi,
    I have written a JSP page and in that i am redirecting it to another page. Now after redirection i am printing a statement on the console. It is getting printed whereas when i am printing the same on the browser i am not able to print that. Please can any one tell me the difference between printing the same on the console and browser.
    My first JSP page(one.jsp)
    <%
         response.sendRedirect("two.jsp");
         out.println("After redirect");
         System.out.println("After out");
    %>
    My second JSP(two.jsp)
    <%
         out.println("In two.jsp");
    %>
    Thanks in advance
    regards
    Prashanth

    The sendRedirect sets a code in the HTTP response being sent to the client (I believe it is a 302 code but I am not sure off hand) and then proceeds to process the rest of the JSP on the server which is why the print statement shows up in the console.
    The out.println writes to the HTTP response output stream. The client gets the response and sees the HTTP Header code telling it to make a new request so it stops processing the response message and sends a new request message which is why the out.println message is not seen in the browser.

  • Redirect or forward in method

    Hi!
    I'm using Strus and this is my problem. I have this method A which have input and outpur parameters. There is try/catch block in method A that capture Exceptions. I want to redirect or forward to jsp page B from method A when some error is happend and NOT to return to class C from which i invoke method A. Is this possible to achieve?
    Tnx :-)

    Tnx for replay, but i don't want to do job in "your" way :-) i'll try to avoid that, because, if i can redirect/forward directly from method A, than i need to write only one redirect/forward, but if i catch exception in class C than i need to do this redirect/forward every time i call method A. that part of code i try to avoid, if it posible...
    Any more suggestion?

  • Losing beans after redirecting in jsp

    hi , everybody
    I am new in web programming.
    this is my jsp :
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <bean:write name="mess" property="text"/><br>
    your username: <bean:write name="user" property="name"/><br>
    your password: <bean:write name="user" property="password"/><br>
    To add the book to Database click <a href="/pages/BookAdding.jsp">here</a><br>
    To rent the book click <a href="pages/RentBook.jsp">here</a>
    </body>
    </html>
    <as you can see here i have 2 javabeans 1-mess 2-user
    and 2 possibilities for redirection (<a href....>)
    after redirection my beans are null....
    somebody can help me please???
    thanks

    First of all, the taglib declaration should be on the top of you jsp.
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <bean:write name="mess" property="text"/><br>
    your username: <bean:write name="user" property="name"/><br>
    your password: <bean:write name="user" property="password"/><br>
    To add the book to Database click <a href="/pages/BookAdding.jsp">here</a><br>
    To rent the book click <a href="pages/RentBook.jsp">here</a>
    </body>
    </html>The beans are lost because they have either a page or a request scope.
    To avoid this, put them in the session scope instead.
    A very good tutorial here http://courses.coreservlets.com/Course-Materials/csajsp2.html
    See The JSP 2.0 Expression Language: Simplifying MVC and Access to Java Code part.
    Hope it helps

  • My secutiry code is not working after installing IOs5. The phone has asked for a new code after intalling it and now the phone is bloqued.

    Problem with security code.

    If you're referrning to the passcode, it's normal for you to have to reenter the code after updating.  If you don't remember what you put in, you have to restore the phone as new, without using a backup.

  • Cannont update E70 nad bug with phone code after b...

    launch NokiaSoftwareUpdate v1.4.39pl
    accept and start update to software 3.0633.09.04 ( using USB cable)
    time remaning 15 mintes ... nokia have white screen , during proceed to 9 minutes , and e70 is reset after reset , on e70 screen show :
    AFE_TEST_SERVER ,w19_06,(c) NMP
    test mode
    nokia
    update show information with 2 steps about put out a battery ,
    after hard reset phone is run but its a problem with PHONE CODE
    after i configure a phone i change default code to my code xxxxxx
    but after bad update code is reset to unknown code
    other bug i found my personal code enter when i change a phone code and enter twice new code show me msg error [-6]
    but old code enter correctly becouse if i use another code then after put twice new code show me message a invalid code .

    Can you please try generating and re-inserting the FB code on your page. The FB Likebox at the above link doesn't load for me from any of the mobile devices nor through a desktop. You can get the code here.
    https://developers.facebook.com/docs/reference/plugins/like-box/
    I was referring to the following Facebook Page URL that you are currently pulling the Streams and Likes for - http://www.facebook.com/phillyweddingdj which appears to be invalid. If you generate the code for it at the above mentioned plugin page, the preview doesn't generate. Visiting this link takes you to FB homepage instead.
    This is how the Likebox code should look like with minimum customization that you need to insert through Object -> Insert HTML option, notice the highlighted part that needs to be modified with a valid FB Page URL:
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <div class="fb-like-box" data-href="http://www.facebook.com/myfbpage" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>
    </div>
    Thanks,
    Vinayak

  • Ask for code after 1 min.?

    Doesn't THE function of ask For code after 1 min. ask THE code after 1 min. after unlock öre only after 1 min. after I turn my iPhone on?

    If that doesn't help, tap Settings > General > Reset > Reset All Settings
    after boot up make your changes again and see if it works

  • Error code after itunes update -42404

    error code after itunes update -42404 cannot connect to ipad it is telling me to restore ipad, and cannot connect to store...
    Message was edited by: CFC.Steve

    I assume you updated itunes on your computer. PC or Mac?
    Look at the posts in the More Like This area to the right side of this page.
    Update and restore alert messages on iPhone, iPad, and iPod touch
    http://www.buybuyla.com/tech/view/012953a0d412000e.shtml
    iOS: Resolving update and restore alert messages
    http://support.apple.com/kb/TS1275
    iPad: Unable to update or restore
    http://support.apple.com/kb/ht4097
    iTunes: Specific update-and-restore error messages and advanced troubleshooting
    http://support.apple.com/kb/TS3694
     Cheers, Tom

  • None exist error  code after a graceful shutdown

    I'd like to return a none zero exit code after a normal graceful shutdown.
    My end task is to be able to send a restart event to a number of machines running my application that will gracefully shutdown and inform the shell script that started it that it wants to be restarted.
    One option would be System.exit with a shutdown hook that monitors the current threads, and does not end until the other threads have also exited, but I would have to inform this hook of threads that should be allowed to finish naturally. But that seams a little [t]icky.
    I guess I could write to a file, and then close down naturally. But this leaves files drifting about. I'm not overly keen on that either.
    Any other suggestions? Thanks, Mike

    The "worker" thread should
    not be interupted, and told to exit, just left to
    exit under there own steam. (when they have finished
    the current job). What is the "worker" thread ? Is it what I meant with "watcher" thread ? Is that what you said or what I said ?
    And, I assumed we are talking about a server-like application, that is one running indefinitely, as opposed to one that would perform a specific task and then terminate. Am I correct ?
    The initalization of this new type of
    shutdown/restart is currently undefined, but will
    likely that the application start listening on a
    socket connection. I'm sorry, I don't understand that at all.
    I want this to ease deployment,
    currently when I deploy a new version I type "ant
    deploy", then VNC on to each of the computer
    (currently just 3, but likely to be more soon) and
    manually restart. What I want is to just type "ant
    deploy" it sends a signal to the running copies, and
    they restart themselfs. (I'm a lazy brsatard).You know this quote by Larry Wall (?) about the three most important characteristics of a programmer, don't you ?
    >
    and thus the exit code is already defined.Not so with what I would consider a "graceful
    shutdown". Then the application would shut down as
    all the threads have completed.It depends on whether having "all threads completed" is a normal part of the application's flow. If I assumed correctly we were talking about a server-like app, then it's not. Ergo the command to terminate has to be issued at some point. The question is how that gets done. For instance, if you send a CTRL-C from the shell, your application shuts down with an error code != 0.
    A graceful shutdown needs to be initiated somewhere. How do you plan to do it ?

  • 2106f Error Code after Internet Recovery Attempt

    Anyone ever get a 2106f Error Code after Internet Recovery Attempt? What next?
    Background: Macbook Pro (late 2011) shows startup progress bar, goes ~ 1/10th of distance, freezes, then goes black after ~2min. Did this:
    1. Clean startup attempt (shift)
    2. Zapped PRAM (option command P R)
    3. Reset SMC, Startup
    4. Attempted Internet Recovery process (Cmd R) over ethernet connection, but after several hours, got the -2106F error.
    MacBook Pro 2.2 i7 Late 2011

    How long were you able to watch this movie before it crashed?
    Now is it everytime you boot up, you get the BSOD  0xc0000001 ?
    Can you start up in SAFE MODE?
    "Knowledge should be unrestricted and the most important commodity we can offer to help one another."

  • Running jquery code after button submits successfully.

    All,
    I need help with running a jquery code after submit button has successfully completed, how do i integrate these 2 events ? clicking the submit button and if submits successfully execute the small jquery code based on the same submit button,
    thanks & regards

    Hi,
    It seems you have not done to example what I did propose.
    Create new hidden item to your page e.g. P15_PROMT.
    Create process that fires on submit after validations and sets item P15_PROMT value to "Y".
    Create on dynamic action that fires on event page load. That dynamic action should execute your jQuery code.
    Set dynamic action conditionally by P15_PROMT value "Y".
    You need also clear item P15_PROMT value, so that dynamic action do not fire every time when you access to page.
    Regards,
    Jari
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai
    Edited by: jarola on Jan 28, 2013 6:52 AM

  • Confirm OK/Cancel: could not stop processing after redirect

    I am have a problem doing a JavaScript confirmation which in a cfinclude file in the process page.
    When the display page send content to the process page, and process page first do some validation which is included in a cfinclude file. The issue is user need to choose from a confirmation message box, choose OK to continue processing, Cancel to send user to previous display page. Every thing seems working, except when user choose Cancel and is sent to the previous page, the execution on the process page continues anyway, behind scene though. Without server process validation you may not realize it. but the truth is it does not stop when user choose Cancel.
    So I need your insights how to handle the situation: give user choice to choose but when user select Cancel, stop the execution of the code after cfinclude.
    Is there anyway to do the message box without JavaScript? If only it could be done in Coldfusion, then the problem solve, by setting a coldfusion variable to stop the execution.
    Please help!
    Thanks
    Jush

    Keep in mind that cf runs on the server, js runs on the client, and the two don't know what the other is doing.  You have a couple of choices.
    1.  Put the validation on the initial page so that selecting cancel keeps them on that page.
    2. Have a page that does validation and nothing else.  Have the rest of the code on another page.  Use js to send the user to the proper page depending on what they select with the confirm dialogue.

  • How to invoke a Java Custom Code after creating a resource in OIM Console

    Greetings.
    I want to invoke a custom code after creating the resource "OID User" on the OIM Administration Console. For example invoke a custom code that creates The Form's resource access descriptor (RAD) on the OID.
    I have read the Developer's Guide for Oracle Identity Manager book but I don't get how to solve my requirement.
    Should I use a "Java Task" on the design Console?
    Could Anybody provide me the detailed steps to do that?
    Thanks
    Ramiro Ortíz.

    Greetings.
    I want to invoke a custom code after creating the resource "OID User" on the OIM Administration Console. For example invoke a custom code that creates The Form's resource access descriptor (RAD) on the OID.
    I have read the Developer's Guide for Oracle Identity Manager book but I don't get how to solve my requirement.
    Should I use a "Java Task" on the design Console?
    Could Anybody provide me the detailed steps to do that?
    Thanks
    Ramiro Ortíz.

  • I need to reinstall CS5 on a machine that has had to be reformatted, i need a Support Code after obtaining the Challenge Code. Please help

    I need to reinstall CS5 on a machine that has had to be reformatted, i need a Support Code after obtaining the Challenge Code. My email address is <removed - kglad>
    Please help

    <moved from Adobe Creative Cloud to Downloading, Installing, Setting Up>
    use your serial number to activate.  if you cannot connect to adobe's server's to activate, Sign in, activation, or connection errors | CS5.5 and later

  • HT2397 can i change the regional code after it has misstakenly been changed to a permanent ?

    i cant change my regional (DVD) code after i misstakenly have changed the code !!!!    can someone please help me ?

    After five changes the player is locked on the last one.  You would have to replace the drive with another one.
    Ciao.

Maybe you are looking for

  • Oracle forms 11g , mailmerge errors WUO-712 and WUO-707

    error client_ole2.set_property(mm_obj, 'Destination', 0); WUO-712 Unable to set Property: {0}; Exception: {1}.Type: UserDescription: WebUtil was unable to set the specified Property tothe specified value client_ole2.invoke(mm_obj, 'Execute'); WUO-707

  • Problem with Prometric exam center

    Hi, I would like to find out where can I get help if I face problem with Prometric exam.   I had registered with Prometric for exam 70-647 on 16-Sep at 10:00AM. On 16-Sep, I reach the exam venue and was inform that the exam venue was close. I had was

  • LCDS web service call throwing error for valid XSD URL

    Hi, I am trying to call a web service which is deployed on a J2EE application[ Project name : WebServiceApplication ] through a different LCDS application [ Project name : lcdsTestWebService] But while loading of mxml following error comming into con

  • Converting Xml object strait to AS3 ....

    Hi there, I would like to find out a strait convertion from this Xml object to AS3 which would have to be the same (outcome / use / readout) as code below including a Http call !!! NO, Combobox or a List !!! Strait forward to be used in a function()

  • E4200v2 - not serving it's purpose..

    Very disappointed! I bought this router as it was supposed to be the top of the line router with the option to attach external storage. It was an easy setup. I have struggled to get the USB to work though. The router recognizes the storage but I'm un