How to forward after output stream is open

Hi
          I want ot forward one jsp page to another, but the output stream of the jsp
          page is open and content is showed.
          I know <jsp:forward> can't work now. Then what can i do?
          Thanks all
          

          You can also set autoFlush to false and increase the buffer (session). Her is an example:
          <%@ buffer="1024kb" autoFlush="false" import="java.io.*" %>
          If the buffer is full and you did not flush him, you will get an IOException.
          Robert Patrick <[email protected]> wrote:
          >It doesn't matter if the OutputStream is open, it matters whether or not
          >the
          >OutputStream has been flushed. If you are not explicitly flushing it (or
          >flushing it implicitly by using jsp:include), you might want to play around
          >with moving some of the content so that the buffer size is not exceeded
          >(which
          >causes it to be flushed) before the jsp:forward is encountered or try
          >increasing the size of the buffer...
          >
          >Hope this helps,
          >Robert
          >
          >andy wrote:
          >
          >> Hi
          >> I want ot forward one jsp page to another, but the output stream of the
          >jsp
          >> page is open and content is showed.
          >>
          >> I know <jsp:forward> can't work now. Then what can i do?
          >>
          >> Thanks all
          >
          

Similar Messages

  • How to print an output stream on console.

    Hi,
    I am new to JAVA. I am trying to execute a command in runtime and I want to print the output on console and also redirect the output to a file.
    Could anyone please help me?
    This is what I wrote :
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("cmd /c ipconfig");I am getting an output stream by : proc.getOutputStream(). I dont know how to print it on console and also how to redirect it to a file.
    Could anyone please help me.
    Thanks in advance.
    Basav

    You can do it this way :-
         public static void main(String args[]) throws Exception {
              ProcessBuilder builder = new ProcessBuilder("ipconfig", "/all");
              Process process = builder.start();
              BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
              FileWriter writer = new FileWriter(new File("C:/ipconfig.txt"));
              String str;
              while ((str = reader.readLine()) != null) {
                   System.out.println(str);
                   writer.write(str + System.getProperty("line.separator"));
              writer.close();
              reader.close();
         }Let me know if it works for you.

  • Java Sockets and Output Streams

    Hi All,
    I am beginning sockets programming and I have a problem. If there is a server listening in the background for incoming connections and say for example 4 client programs programs which we shall call client1...client4 connect. How best can I capture the output streams associated with these newly created sockets so that the server can send back isome nformation to say clients1 and client4 only which is not seen by clients 2 and 3. Similarly I would like the server to send some infor to clients 2 and 3 only which is not seen by client1 and client 4.
    Currently I have the server listening part as shown below, but not too sure how to add DISTINCT output streams for 1 and 4 on one hand and 2 and 3 on the other.
    Thanks:
    // bind socket to a port number
    ServerSocket serverSocket = new ServerSocket(portNo);
    // create socket to listen to client connection
    while (true) {
    //listen to an incoming connection
    System.out.println("chatroom server waiting for incoming connections");
    Socket incomingSocket = serverSocket.accept();
    //launch new thread to take care of new connection
    chatRoomThread chatThread = new chatRoomThread(incomingSocket);
    chatThread.start();
    //go back and wait for next connection
    Please help.
    Thanks,
    Bleak

    HouseofHunger wrote:
    yes thats exactly the way I have my in and out streams, in the run method, but that doesn't help me in filtering traffic, in other words I am saying 2 clients, client1 and client4 for example should share a common in and out stream so that they will see eact other's messages... makes sense.....?No, doesn't make sense. That's the wrong design. Each socket should have its own input and output stream (yes, I know, that's been said several times before). If messages going to client1 should also be sent to client4, then whatever writes the messages to client1's output stream must also write them to client4's output stream. Trying to make those two output streams actually be the same output stream is the wrong way to do that. Just have the controller send the messages to whoever is supposed to get them.

  • Servlet Output Streams and clearing

    I am using servlets, and I want to be able to print something repeatedly. Well, that's not exactly true: I can print something repeatedly. Using a ServletOutputStream, it doesn't seem possible to clear what has already been written. Here's the code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.io.*;
    public class AlwaysTime extends HttpServlet {
         public void doPost(HttpServletRequest req, HttpServletResponse res)                throws ServletException, IOException {
              HttpServletResponse oldRes = res;
              Date now = new Date();
              res.setContentType("text/html");
              ServletOutputStream out = res.getOutputStream();
              out.println("<html>");
              out.println("<head>");
              out.println("<title>Clock</title>");
              out.println("</head>");
              out.println("<body>");
              out.println("<h1 align=\"Center\">");
              out.println(now.toString());
              out.println("</h1>");
              out.println("</body>");
              out.println("</html>");
              try {
                 Thread.sleep(1000);
              } catch (InterruptedException ie) {}
              // Do nothing: wait for 1 second.
              doPost(req, oldRes);
         public void doGet(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              doPost(req, res);
    }This code prints the time every second, but I want to clear the previous output stream. I thought the code shown above would work, but of course, oldRes points to the same object as res. But I don't know how to clear an output stream, so that it is completely empty. Instead, each of the new lines are appended to the same output stream.
    This doesn't only apply to servlet output streams: is there some way to clear the System output stream, for instance?
    But mainly the servlet output stream ...

    You would not want to use HTTP for this type of functionality. HTTP is known as a 'stateless' protocol that simply returns one exact response for each request. So, there is not way to 'clear' the stream (technically, you would not do so for 'normal' streams either, but when you add HTTP into the mix, the task is definitely not possible).
    You could implement the above using a RSS feed, or by using HTTP meta-refresh tags on the page itself ot resubmit the requests every second (though this would be inefficient). An applet would also do the task.
    - Saish

  • How can I put an output stream (HTML) from a remote process on my JSF page

    Hello,
    I've a question if someone could help.
    I have a jsf application that need to execute some remote stuff on a different process (it is a SAS application). This remote process produces in output an html table that I want to display in my jsf page.
    So I use a socket SAS class for setting up a server socket in a separate thread. The primary use of this class is to setup a socket listener, submit a command to a remote process (such as SAS) to generate a data stream (such as HTML or graphics) back to the listening socket, and then write the contents of the stream back to the servlet stream.
    Now the problem is that I loose my jsf page at all. I need a suggestion if some one would help, to understand how can I use this html datastream without writing on my Servlet output stream.
    Thank you in advance
    A.
    Just if you want to look at the details .....
    // Create the remote model
    com.sas.sasserver.submit.SubmitInterface si =
    (com.sas.sasserver.submit.SubmitInterface)
    rocf.newInstance(com.sas.sasserver.submit.SubmitInterface.class, connection);
    // Create a work dataset
    String stmt = "data work.foo;input field1 $ field2 $;cards;\na b\nc d\n;run;";
    si.setProgramText(stmt);
    // Setup our socket listener and get the port that it is bound to
    com.sas.servlet.util.SocketListener socket =
    new com.sas.servlet.util.SocketListener();
    int port = socket.setup();
    socket.start();
    // Get the localhost name
    String localhost = (java.net.InetAddress.getLocalHost()).getHostAddress();
    stmt = "filename sock SOCKET '" + localhost + ":" + port + "';";
    si.setProgramText(stmt);
    // Setup the ods options
    stmt = "ods html body=sock style=brick;";
    si.setProgramText(stmt);
    // Print the dataset
    stmt = "proc print data=work.foo;run;";
    si.setProgramText(stmt);
    // Close
    stmt = "ods html close;run;";
    si.setProgramText(stmt);
    // get my output stream
    context = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
    ServletOutputStream out = response.getOutputStream();
    // Write the data from the socket to the response
    socket.write(out);
    // Close the socket listener
    socket.close();

    The system exec function is on the Communication palette. Its for executing system commands. On my Win2K system, the help for FTP is:
    "Ftp
    Transfers files to and from a computer running an FTP server service (sometimes called a daemon). Ftp can be used interactively. Click ftp commands in the Related Topics list for a description of available ftp subcommands. This command is available only if the TCP/IP protocol has been installed. Ftp is a service, that, once started, creates a sub-environment in which you can use ftp commands, and from which you can return to the Windows 2000 command prompt by typing the quit subcommand. When the ftp sub-environment is running, it is indicated by the ftp command prompt.
    ftp [-v] [-n] [-i] [-d] [-g]
    [-s:filename] [-a] [-w:windowsize] [computer]
    Parameters
    -v
    Suppresses display of remote server responses.
    -n
    Suppresses autologin upon initial connection.
    -i
    Turns off interactive prompting during multiple file transfers.
    -d
    Enables debugging, displaying all ftp commands passed between the client and server.
    -g
    Disables file name globbing, which permits the use of wildcard characters (* and ?) in local file and path names. (See the glob command in the online Command Reference.)
    -s:filename
    Specifies a text file containing ftp commands; the commands automatically run after ftp starts. No spaces are allowed in this parameter. Use this switch instead of redirection (>).
    -a
    Use any local interface when binding data connection.
    -w:windowsize
    Overrides the default transfer buffer size of 4096.
    computer
    Specifies the computer name or IP address of the remote computer to connect to. The computer, if specified, must be the last paramete
    r on the line."
    I use tftp all of the time to transfer files in a similar manner. Test the transfer from the Windows command line and copy it into a VI. Pass the command line to system exec and wait until it's done.

  • How can I get my safari to open after installing the new Mavericks operating system?

    How can I get my safari to open after installing the new Mavericks operating system?

    Thanks Carolyn. Unfortunately, this didn't work. It turned out to be in my display monitor as I have my computer wired to my tv for streaming. Once I changed the monitor display it worked fine. Go figure

  • After clicking on an open tab, how to make the focus automatically go to the body of page?

    After clicking on an open tab, how to make the focus automatically go to the body of page?
    Right now, clicking in an open tab and using arrow keys now moves through the open tabs. I liked the old versions where right after clicking in a tab you could directly go to navigate the page with the arrow keys.
    Is there a something I can change in about:config to change this behavior?
    Thanks in advanced.

    Firefox should still set the focus the the browser area if you click a tab.<br />
    Only with very old browser versions you could set the focus to a tab by clicking a tab.
    This behavior is likely caused by an extension.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How to use Cinema4D lite with no opening After Effects CC ?

    How to use Cinema4D lite with no opening After Effects CC ?
    Is that possible ?
    Open a 3D object Photoshop-type in After Effects CC (without C4D)
    It is also possible?
    thanks
    xav

    It is as Mylenium says.
    See this page for details such as this:
    "You open the version of CINEMA 4D that is installed with After Effects using the New > MAXON CINEMA 4D File command or the Edit Original command in After Effects. You will not see this version of CINEMA 4D installed in the Start menu on Windows or in the Applications directory on Mac OS."

  • Please tell how to do, that when I want to forward a message, a message opens in new tab, not in a new message window in thunderbird. Thanks.

    Please tell how to do, that when I want to forward a message, a message opens in new tab, not in a new message window in thunderbird. Thanks.

    Sorry, but at the moment 'Compose in a tab' isn't yet possible. You'll always get a new windows when composing or replying/forwarding a message.

  • JDev 10.1.2 [UIX]: After uploading a file, how to forward to next page?

    Hello guys,
    I've got a DataPage to upload a file, I followed the example in JDeveloper's help (Using a Controller in ADF UIX -> Uploading Files Using the UIX Servlet). The files are uploaded fine. But I can't figure out how to forward to the next page (or struts action) to process the file, after uploading it just returns to the upload page. Can anyone give me a hint?
    Thanks.
    Fer.

    Dear sir...
    i faced the same problem before, and yet no one helped me, however there is a workaround, though i do not think it should be done. however the steps are as follows:
    1- go to the code of the page.
    2- override the processupdatemodel method, adding only this line:
    actionContext.setActionForward("nextpage");
    3- draw a forward from the upload page into the next page.
    i hope this would help solving your problem.
    please if you find a better solution, post it here.
    good luck.

  • Hey plz help me out!!  i am using macbook pro 10.5.8..... and was using photobooth...and then after some time i opened it and there was no green light on cam, and it displayed nothing! plz tell me how to fix it! i want to see my face again!!! plz help me

    hey plz help me out!!  i am using macbook pro 10.5.8..... and was using photobooth...and then after some time i opened it and there was no green light on cam, and it displayed nothing! plz tell me how to fix it! i want to see my face again!!! plz help me

    iSight troubleshooting
    http://support.apple.com/kb/HT2090

  • Opening Output Stream to a file on the server from Applet

    Hi,
    I am trying to write a little applet which parses a file found on the server , lets the user select some Strings then write the selected Strings to a different file on the server. I use the following code:
    String fileName = new String("LineUp");
    URL docBase = null;
    URLConnection conn = null;
    try {
    docBase = new URL(ApppletName.codeBase, fileName);
    } catch (java.net.MalformedURLException e) {
    System.out.println("Couldn't create image: "
    + "badly specified URL");
    try {
    conn = docBase.openConnection();
    } catch(IOException e) {System.out.println(e);}
    String playerString;
    try {
    conn.setAllowUserInteraction(true);
    conn.setDoOutput(true);
    conn.connect();
    PrintWriter out = new PrintWriter(
    conn.getOutputStream());
    etc..
    The problem I am having is that the getOutputStream routine for the connection object does nothing other than throw an exception (I've stepped through the code and that is all the routine actually does). The connection is actually made but no output stream can be created. I have looked at the Java Tutorial (as I am fairly new to Java) and found a spot where they tell you how to write to a file on the server, which is the example I have followed. Any suggestions? What am I missing?

    Yes, that's what I thought. It talks about writing to a URL, and you have interpreted "URL" as if it meant "file". A URL is a "Uniform Resource Locator", which is a string that identifies a "resource" on the server. Often that corresponds to a file on the server, but not always. It could be a page that is dynamically generated by a script on the server.
    Look again at that page and you will see these words: "At the other end, a cgi-bin script (usually) on the server receives the data, processes it, and then sends you a response, usually in the form of a new HTML page." What that means is, you can't just upload a file to a URL unless you have programmed the server to deal with that upload. That's part of the basic design of the HTTP protocol.
    So, unfortunately, you can't do what you want all that easily. You would have to provide some programming at the server to handle the file upload for you. In Java that means writing a servlet and getting the web server to have that servlet handle all requests to a particular URL. I suspect you don't want to get into that just yet. But if you do, any decent book on Java servlets should have an example of how to upload files like this.

  • HT1689 I redeemed a digital movie but have not downloaded it yet. How can I download or stream the movie after I've selected download later?

    I redeemed a digital movie but have not downloaded it yet. How can I download or stream the movie after I've selected download later?

    Hello geoff1718,
    The following article provides steps for downloading past purchases from the iTunes Store.
    Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/HT2519
    Cheers,
    Allen

  • How to read unix standrad pipe output stream

    I want to write some code that will read data from a standard solaris pipe output stream. Please help.
    For example
    I cat a file in a unix shell
    cat /etc/hosts
    The output of this file can be piped to another program and I want to write a piece of code that reads that piped data and puts it into a textArea.
    Thanks

    Here ya go bro.................
    This just checks if IO is coming in and if so prints it to the term, but
    you get the idea.
    There might be an better way but...........
    import java.io.*;
    class xxx
    public static void main(String args[])
    byte b[] = new byte[256];
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
    if(System.in.available() > 0) {
    System.in.read(b);
    baos.write(b,0,256);
    System.out.println(baos.toString());
    else
    System.out.println("No pipe being layed");
    catch(Throwable t){}

  • After long time i open my ipad ,but showing ipad desactivate what i want to do know,how i can open, after long time i open my ipad ,but showing ipad desactivate what i want to do know,how i can open

    after long time i open my iapd,but i canot open,ipad is desactivate,now i can open

    I am trying to help you but I want to be sure I understand what is going on. I think that you can't "open" the iPad because you have to enter the PIN for your sim card according to this taken from the web site that I referred you to. If you cannot remember your PIN you will have to contact your carrier for a replacement SIM card.
    COPIED FROM THE WEB SITE....
    Summary
    You can lock your SIM card so that it can’t be used without a Personal Identification Number (PIN). You must enter the PIN each time you turn iPhone or iPad Wi-Fi + 3G off and turn it back on again.
    Products Affected
    iPhone, iPad, iPhone Activation in iTunes
    Note: This information applies only to devices that use a SIM card.
    You can enable, disable, or change your SIM PIN in the following locations:
    iPhone: Settings > Phone > SIM PIN
    iPad Wi-Fi + 3G: Settings > Cellular Data > SIM PIN
    Note: Some carriers provide SIM cards with a default SIM PIN already enabled. Contact your carrier to find out what your default SIM PIN code is.
    Personal Unlocking Key (PUK)
    If you enter the PIN incorrectly three times, you may need to enter a Personal Unlocking Key (PUK) to enable your SIM card again. Refer to the SIM card documentation or contact your carrier.
    Note: Entering an incorrect PUK code too many times will result in the SIM becoming permanently locked. If this occurs, you will need to contact your carrier for a replacement SIM card.

Maybe you are looking for

  • HP PL5060N Plasma HDTV

    I have taken my plasma tv off of its wall mount and would like to use the TV stand.  However, i am missing one of the TV stand mounts which attach to the back of the television.  A picture of what I am looking for is on Page 8 of my User's Manual.  I

  • Cannot Access Certain Websites from MBP

    I've tried setting DNS to 8.8.8.8 as well as connecting via Ethernet as well as with my wireless broadband dongle, and still no luck. In fact, when I connect my dongle my internet connection goes even worse and I can hardly load any websites at all!

  • Alerts in MOSS 2007 Not Working Correctly: Email is delivered, but content is not included in the email.

    A user is receiving an alert on a list when anything is modified, but the alert is just a blank email.  Anyone experience this behavior before?

  • Error while upgrading to OS 3.0 GM seed

    Hi, I wanted to upgrade to the OS 3.0 GM seed. I opened Xcode, opened Organizer and choose the new OS file. Suddenly while starting to restore it gave an error: Connected to device, path does not exist. It now only gives that error. My iPhone only sh

  • Jms QueueImplementation Problem

    Together with a friend we are writing a workflow system with the j2ee technology. We used a jms queue in the implementation and everything runned fine. But one day, my processor broke. I got to buy a new one as also a new motherboard (AMD / ABIT). I