Including the output of a jsp in one server into the a jsp in another serve

Hi,
I have a web server(w1) which contains a jsp file (jsp1).
I have an application server(a1) which contains a jsp file (jsp2).
Both w1 and a1 are running in different machines.
I want the output of jsp2 to be inserted into jsp1.
The control should always be in jsp1. Just like a method call jsp2 should be executed and results are to be included in jsp1.
Hope my explaination is clear.
include tag is not working for the above scenario.
Can anybody help me with a piece of code.
Thanks in advance.
Regards,
Sathish E.

Why don't you just create a new URL object to jsp2 read in the stream and write it into jsp1.
For example:
// this is jsp1
URL url = new URL( "http://www.somewhere/jsp2" );
HttpURLConnection con = ( HttpURLConnection ) url.openConnection();
con.setRequestMethod( "POST" );
con.setAllowUserInteraction( true );
con.setDoInput( true );
con.setDoOutput( true );
// Post any arguments here.
OutputStream os = con.getOutputStream();
os.write( ( "FNAME=" + fName + "&LNAME=" + lName ).getBytes() );
os.flush();
reader = new BufferedReader( new InputStreamReader( con.getInputStream() ) );
// Read response from jsp2
while ( ( line = reader.readLine() ) != null )
// write the response into jsp1
out.println( line );
Hope this helps,
Nick

Similar Messages

  • Including output in a JSP page from a separate Web App

              I seem to be having a bit of a problem including the output from a sevlet invoked
              from a separate
              Web Application in the same domain. I have a servlet callsed 'WebApp2\Web-inf\classes\packagename\targetServlet'.
              I am attempting to invoke 'targetServlet' from 'WebApp1\somepage.jsp' using the
              jsp:include directive but I seem
              to be having a path problem because the servlet is not invoked. Anyone have any
              suggestions?
              

              Mark:
              You cannot do that with <jsp:include>. You can read the JSP spec to learn more
              about it.
              Anyway, there are some tags out there that do allow what you need. I, for one,
              use Struts' <bean:include> tag. See http://jakarta.apache.org/struts/
              The new JSTL (JSP Standard Tag Library - http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html)
              provides the <c:import> tag.
              Greetings
              "Mark Andersen" <[email protected]> wrote:
              >
              >I seem to be having a bit of a problem including the output from a sevlet
              >invoked
              >from a separate
              >Web Application in the same domain. I have a servlet callsed 'WebApp2\Web-inf\classes\packagename\targetServlet'.
              >I am attempting to invoke 'targetServlet' from 'WebApp1\somepage.jsp'
              >using the
              >jsp:include directive but I seem
              >to be having a path problem because the servlet is not invoked. Anyone
              >have any
              >suggestions?
              

  • Including the results of a jsp into an HTML page

    Hey everyone,
    I am trying to include the results of a jsp inside an HTML page (HTML served by Apache, JSP served by Tomcat).
    Is there any straight way of doing this - say using Ajax or some javascript? I have been experimenting with ajaxinclude from DynamicDrive.
    Appreciate the help,
    Ankush

    Well, u can do one thing, may not be a proper method...
    one way is to call the jsp page using ajax and the output of the jsp page can be converted to an xml and this xml can be read by the ajax program.

  • How to include jsps's of one application into another

    Hi people,
    I want to include a jsp from one web application into another. I have specified in the web.xml in Tomcat/conf directory that both the applications are "crosscontext=true". But tomcat fails to include the jsp from the other web application. It always tries to look for that resource with respect to the context of the current application.
    Any idea how do I go about it. Any suggestion will be greatly appreciated.
    Thanks,
    Subhadeep De.

    In the standard Sun JSTL tag library there is a tag that will include the output of the jsp in your jsp. I beleive the tag is called "include" or "import" but I forget the exact name. I also believe that you'll have to pass any needed parameters.

  • Including the same html code in many JSPs

    Hello there!
    does anyone knows how can I
    include some html code into my jsp?
    I have to include it in all my JSPs, so I was thinking
    in a kind of "include"-tag
    written once in a file and being included in all other pages,
    without having to write it overe and over
    Thanks!

    (8-0)
    so easy
    think I'm needing a good page where all the tags are listed
    do someone know one?
    (each good page win a Duke)
    Thanks

  • Download from ALV are all in one column including the header

    Hello All,
    We are having problems with the download of excel from ALV grid. what happens is that instead of the data dispalying in different columns, it is all in one column, including the header. what could be the problem? this only occurs in the production system but in the development and quality it is ok.
    Thanks for your help.

    Hi,
    We also used the option download to local file and it works fine. Only the button download to excel is not working as expected.

  • I downloaded IOS6 and all my apps, including the App Store icon, disappeared. If I go to the Passport icon, there is an App Store button, but I have to search through all the apps to find the one I want  and then click on "Open" to use it.  Help!

    I downloaded IOS6 and all of my app icons, including the App Store icon disappeared. Now to use an icon, I have to go to Passport and click on the App Store button at the bottom and search through all of the apps to find the one I want and then click on Open. There doesn't seem to be a way to delete the app and start over.

    Hey PlayerPS,
    Thanks for the question, and welcome to Apple Support Communities.
    It sounds like the application you are looking for is indeed still on your iPhone. You can confirm this by searching in the Spotlight Search for this application. It may have accidentally been moved to a folder, or an additional Home screen:
    iOS: Understanding Spotlight Search
    http://support.apple.com/kb/HT3636
    via http://manuals.info.apple.com/en_US/iphone_user_guide.pdf
    Thanks,
    Matt M.

  • I have a Windows 7 laptop using I tunes 64 and all my music files are on an external disc. I rarely use I tunes and at one point moved all my files (including the music files) from one external disc to another without considering what affect this wou

    I have a Windows 7 laptop using I tunes 64 and all my music files are
    on an external disc. I rarely use I tunes and at one point moved all my files
    (including the music files) from one external disc to another without
    considering what affect this would have on the I tunes library. When I eventually
    attempted to use I tunes, every selected a song from the library resulted in a
    message stating that the file couldn't be located. After following some of the procedures
    explained in this community I was able to reconnect the library back to where
    the associated music files are presently stored. However, there are still 2
    problems that need to be corrected. 1) Every song file now has a duplicate. One
    file works and the other file will result in the same message stating that the
    file couldn't be located. Before there were 4,000 songs in the library, now
    there are 8,000 songs. I need to eliminate the 4,000 dead song files. 2) All
    the playlists are still associated with the dead song files which makes the
    playlists unusable. Can the playlists be reconnected to the usable files
    without manually having to recreate them? Thanks in advance for the help.
    sdkr

    So am I understanding correctly?
    You used your iPod as a hard drive (drag and drop) instead of having iTunes install the music?
    If you used drag and drop your choices are different than if you used iTunes to transfer.
    Good luck!

  • I just bought a new desktop and will be taking my old one to the apple store tomorrow to have the data transferred. Does the transfer include the transfer of programs or just data?

    I just bought a new desktop and will be taking my old one to the apple store tomorrow to have the data transferred. Does the transfer include the transfer of programs or just data?

    They will simply use Migration Assistant to transfer your Home folder, third-party applications and support files, and system preferences. This is something you could do yourself. You would need a Firewire cable to connect between your old computer and your new one. Migration Assistant is installed in the Utilities folder of your new computer.
    See Transferring files between two computers using FireWire and How to use Migration Assistant to transfer files from another Mac.

  • Error flushing the output stream in Sun One server

    Hi All,
    I was running my servlet code in iPlanet 6.0 version and it was working fine. I upgraded my web server to new Sun One server (Oracle-iPlanet-Web-Server-7.0.9). With the new web server almost 90% of my application works fine, but there is a features in my application to download an Excel sheet by clicking a button. This feature is failing in new Sun One web server.
    Below are my piece of code and the error log I m getting. Can anyone tell me how I can fix this error, I mean is there any web server specific change or configuration parameter need to be set.
    Please ask for any information regarding my server configuration settings if needed for finding a solution for this
    Code:
    byte abyte0[] = new byte[1024];
    BufferedInputStream bufferedinputstream=null;
    BufferedOutputStream bufferedoutputstream=null;
    java.io.InputStream inputstream = httpurlconnection.getInputStream();
    bufferedinputstream = new BufferedInputStream(inputstream);
    bufferedoutputstream = new BufferedOutputStream(httpservletresponse.getOutputStream());
    int j;
    long byteCount=0;
    while((j = bufferedinputstream.read(abyte0, 0, 1024)) != -1)
    byteCount=byteCount+j;
    if(logger != null && logger.traceOn())
    logger.log("total"+byteCount);
    logger.log("Read bytes:"+j);
    bufferedoutputstream.write(abyte0, 0, j);
    if(logger != null && logger.traceOn())
    logger.log("Wrote bytes:"+j);
    bufferedoutputstream.flush(); // <<<<<< ERROR POINT >>>>>>
    Error Log :
    ClientAbortException: java.io.IOException: WEB8004: Error flushing the output stream
    at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:343)
    at org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:313)
    at org.apache.coyote.tomcat5.CoyoteOutputStream.flush(CoyoteOutputStream.java:147)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
    at com.reuters.bdec.as.ASRequestHandler.processResponse(ASRequestHandler.java:285)
    at com.reuters.bdec.as.ASRequestHandler.initiateGetRequest(ASRequestHandler.java:89)
    at com.reuters.bdec.as.ASRequestHandler.proceedToDestination(ASRequestHandler.java:220)
    at com.reuters.bdec.as.ASExtension.authorisationCheck(ASExtension.java:84)
    at com.reuters.bdec.as.ASExtension.doGet(ASExtension.java:114)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:794)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:915)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
    at com.sun.webserver.connector.nsapi.NSAPIProcessor.service(NSAPIProcessor.java:160)
    Caused by: java.io.IOException: WEB8004: Error flushing the output stream
    at com.sun.webserver.connector.nsapi.NSAPIProcessor.action(NSAPIProcessor.java:243)
    at org.apache.coyote.Response.action(Response.java:197)
    at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:339)
    ... 20 more

    Don't flush it yourself. The servlet container will automatically flush for you once its send buffer is full. You can change the size of the send buffer though.

  • Capturing the output of a jsp page and save that output in a WORD .doc file

    Hi,
    This is Naveen. I got stuck up with a problem/doubt. URGENT ! URGENT !
    My doubt is how to capture the output of a jsp page(the content is dynamic generated) and save that output to a MS-Word doc file.
    I know that therez an option of using Servlets Filters, but this concept is supported by Servlet 2.3 spec. and not earlier. And we are working on previous spec. and our web-servers also supports the prev. version and not the 2.3 version.
    If incase, therez a third-party utility for free usage, suggestions are appreciated.
    Hope most of them came across this kind of functional requirement. If anyone of them succeeded in this, please express ur bitter experience if any, faced during the coding.
    Thanks in Advance for help.
    Naveen

    You can set the MIME content type as .doc and try to open the Page.
    res.setContentType("application/vnd.ms-excel"); to generate the Page output as Excel
    res.setContentType("application/vnd.ms-word"); to generate the Page output as MS Word doc
    Hope this helps..

  • When bates numbering a .pdf in XI, how can I change the file name to include the bates number AND its name?  I know under file output, there is an option for either/or.  I want both.  Thank you.

    when bates numbering a .pdf in XI, how can I change the file name to include the bates number and the file name?  I know under "file output: it's either/or.  I need both.  Thanks!

    Long ago I wrote a little demo using the touch command. Check out the following thread:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=25128#M25128
    LabVIEW Champion . Do more with less code and in less time .

  • My computer had to be repaired and i lost some of my purchases. my purchase history does not include the ones that are missing and the ones that do appear indicate they are free purchases.  none of my purchases are free i paid so how do a recover them?

    My computer had to be repaired and i lost some of my purchases. my purchase history does not include the ones that are missing and the ones that do appear indicate they are free purchases.  none of my purchases are free i paid so how do a recover them?

    asuming you are talking about the app store try signing into your account using your apple id into the app store.

  • I cant seem to find any of the previous fx textures that i used to have before. Including the nature ones such as water, wall and moon textures.

    I cant seem to find any of the previous fx textures that i used to have before. Including the nature ones such as water, wall and moon textures.

    Please give us some more information: Photoshop version and OS version (First two lines of Help > System Info).
    Did these textures come with your install or are they from a third party?
    How did you access them before? Usually Textures are Presets you load into your Patterns dialog. If you install a new version of Photoshop or Reset Photoshop, you have to go into the Patterns Panel menu and reload them.

  • Can any one tell me how to include the company logo and some poictures into the Teststand report

    1. Can any one tell me how to include the company logo and some pictures into the Teststand report?
    2. How to include the waveforms into the report?

    http://zone.ni.com/devzone/cda/epd/p/id/3619
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • What is the best way to include an xml file in JSP?

    I have a jsp page that I need to include an xml file. The xml file
              uses an xsl to render the file. What is the best way to include the
              xml file and still maintain the structure of the style sheet?
              Thanks
              Jennifer
              

              The best way is using the tag lib. If you cannot, but you can use JAXP, you can
              try
              javax.xml.transform.Transformer.transform(Source xmlSource,
              Result outputTarget)
              throws TransformerException
              You construct the transformer with you xsl, use you xml file or DOM to form xmlSource,
              and use JSPWriter "out" to form outputTarget (StreamResult). But if your JSP page
              generates the xml itself, tag lib is the only way.
              [email protected] (Jennifer) wrote:
              >[email protected] (Jennifer) wrote in message news:<[email protected]>...
              >> I have a jsp page that I need to include an xml file. The xml file
              >> uses an xsl to render the file. What is the best way to include the
              >> xml file and still maintain the structure of the style sheet?
              >>
              >> Thanks
              >>
              >> Jennifer
              >
              >Or is there a way to parse the xml file with the jsp page to display
              >the information. I cannot use the Java Standard Tag Libraries as the
              >version of iplanet we are running does not support the JSTL
              >
              >Thanks
              >
              >Jennifer
              

Maybe you are looking for

  • How to publish a PI7.1 System in SR to create PRovider System in CE7.1

    Hi All, We have CE7.1 EHP1 System. When we try to create a provider system for a PI7.1 system in our landscape, the PI system is not available in the help entries. If we proceed wiht manual entry, in the end it thows the error " Provider system not p

  • Restoring to older file in Time Machine need newer bookmarks

    A month ago I upgraded to Yosemite and have been in computer **** ever since. Last night, I decided to return to Mountain Lion, where life was running smoothly. I erased my drive, turned Time Machine on to restore it back to working level and woke up

  • How to place swf in Interactive PDF below other objects/frames

    Hello there, My first post here , I hope one can help. I want to make a PDF with some text/content on top, and swf animation in the background - below content. So I place SWF file into InDesign, bring it to the layer below texts, then I make spread p

  • USB file copy slow

    Hi. I am having some problems to copy files from USB, the process is really slow. Took 30 min to copy only 1,3 GB from the usb to my home folder. Any solution for this? Using: Arch Linux i686 Kernel Release: 3.0-ARCH WM: Openbox DE: LXDE Processor Ty

  • PhotoshopElementsAnalyzer.exe Running in Background

    I'm new to Premier Elements 8.0 and was experimenting with my first video edits.  I closed the program down, but the PhotoshopElementsAnalyzer.exe continues to run in the background and it is consuming quite a bit of system resources. Q1.  Is this pr