Binary output from two tags

Hi
I'm having problems outputting a binary image from a tag handler more than once. This is apparently a known problem with JSP but I was wondering if anyone had found a workaround (other that writing a servlet).
The basic problem is that if you call ServletResponse.getOutputStream() more than once in a page or if you call it after ServletResponse.getWriter() has been called then you get:
java.lang.IllegalStateException: getOutputStream() has already been called for this response
The result is that Tag Libraries are a technology that doesn't allow you to output two binary things directly onto a page or to output any binary data if you've also output text or vice versa. That sounds extraordinarily bad to me.
I know there must be good reasons for the difficulty but surely there's a fix or a well known workaround.
Has anyone out there got over this problem or know whether any fixes are planned? Thanks.
Murray

You can call either getOutputStream or getWriter, and you can it only once (it assumes you'll assign that to a variable and use the variable from then on). It's not a bug or problem, it's a reasonable restriction to prevent you from doing what I think you are trying to do....
So you can use the writer to write text-based output, or the output stream to write binary data.
But this is somewhat irrelevent. You can't output HTML and include binary data, like an image, in the HTML.
<div>here is some text, followed by an image</div>
<div>0a68df9834ce7932d....</div> <-- binary data...
The browser has no idea what to do with that. That's why you have image tags and object/embed tags in HTML. And the browser has to make a separate request to get the content for the image tag. So the servlet can output image data or other stuff, if the image tag is used to call a servlet to serve an image. But they are not doing with the same call the a servlet (and usually you have separate servlets for that stuff).
Ultimately, this is not a JSP/servlet issue. This is strictly and HTML, HTTP, browser issue: That's how it works and has worked since long before JSP and servlets came about. JSP/servlets do not change how HTML and browsers work in any way/shape/form. They only allow for dynamically generating content the browser gets.

Similar Messages

  • How to send a binary output from ni daq 6009

    I am trying to get a binary output from ni daq 6009 to make the selections of a multiplexer.
    I am trying to make the selection directly from the labview program.
    Please help me in getting this binary output from ni daq 6009 to do the selection

    Try something like this. 
    I'm not a fan of daq-assistant express vi's... use the primitives.  Create the task outside the main structure, pass that task inside the loop and do a write where needed.  Close the task after the main loop.  This improves speed and labview performance.
    Attachments:
    ocelot.png ‏43 KB
    ocelot.vi ‏21 KB

  • How to print one sales order output from two printers using single command.

    Dear all,
    Our requirement is to print single sales order from two different printers, where as one printout for sales order output and another for sales order cash receipt.
    We developed two smartforms for both outputs.
    But we are struggling to assign the smartforms to single document type, which has to result two printouts after saving the sales order.
    Please help us to solve the issue.
    Your suggestions will be highly appreciated.
    Best regards
    Raghu ram

    Hi,
    You should define two different output type for your requests, one is for SO output, the other is for SO cash receipt. That's okay!
    Good luck
    Z.T

  • How Can I Combine the Output from Two CFSEARCH tags

    I am trying to query a verity collection TWICE using CFSEARCH
    then combine the results.
    The first CFSEARCH instance would search the collection by
    treating the entered keywords as a phrase (example: "Digital Photo
    Printer") - the 2nd CFSEARCH would then search the same collection
    by putting a comma in between each keyword term (example:
    Digital,Photo,Printer), thus asking CFSEARCH to look for all of the
    keywords in a document but not necessarily right next to each
    other.
    The question I have - Is there a way to do two CFSEARCH
    queries on a collection and combine the results into one
    <CFOUTPUT QUERY = "ABC"> ?

    I was having data type problem on some search terms and I
    read a post a while back of someone that had the same problem. He
    found a workaround by converting the original data to WDDX then
    back again.
    http://groups.google.com/group/macromedia.coldfusion.advanced_techniques/browse_thread/thr ead/d60200231e20088f/e5419b0f233caf06?lnk=st&q=query+of+query+data+type+problems%2C+coldfu sion&rnum=5&hl=en#e5419b0f233caf06

  • How to synchronize analog input and output from two different USB daq boards

    Hi all,
    I have two very differnt USB boards the NI USB 6008, which I am using to acquire the data (Analog Input) and a NI USB 9263, it is an Analog Output only board that I am using to deliver a signal (in this case a square pulse). The reason why I am not using the 6008 Analog Ouputs is because I need to deliver negative voltages and need the full +/-10V range.
    Looking at similar posts I am pretty sure that I can't use an external trigger or a shared clock, I also tried to use the synchronization of timed structures but no cigar.
    I am including a quick vi that I whipped out showing how the signal jitters due to the lack of synchronization. The AO from the 9263 connects to the AI in the 6008 in this example.
    Solved!
    Go to Solution.
    Attachments:
    Test Pulse.vi ‏117 KB

    I talked to a specialist in the phone and tols me that it is not possible.

  • Comparing digital input and output from two different DAQs

    I want to create this program where the digital output lights up LEDs at random and push buttons are the digital input part of another DAQ are pushed. When the correct button is pushed, the score will increase by 1. My code doesn't work though. Can someone point my errors to me? Both the DAQs i'm using are USB-6008 DAQs. thanks
    Attachments:
    Untitled 1.vi ‏41 KB

    Let's start with the digital output
    What is this code all about?
    Do you want only one of the 8 led's to lit randomly or are multiple led's also ok?
    The two possible codes are in attached file SNAG-003.jpg
    Connect the output of the "Scale by power of 2" function or the "Multiply" output directly to the Write DAQmx vi
    I don't understand the purpose of the "Boolean Value" and "Replace subset array" thing, so I skipped it
    Attachments:
    SNAG-002.jpg ‏49 KB
    SNAG-003.jpg ‏22 KB

  • Combine output  from two data sources for a line graph.

    Hello Experts,
    I need your help in following scenario.
    Scenario - We have a line graph created in VC. We have a numeric field in the data seris and a date field in the Category axis.
                      This is working fine.
    Requirement - Customer wants month names instead of dates on the category axis of the line graph.
    Problem - The RFC which is providing the data to line graph doesnot have a output field giving month names instead it has dates.
    Options Tried - Tried using 'Union' and 'Switch' operator with a RFC giving month names. Unfortunately this doesnot work.
                             One close try was with 'union' operator but it ignores the numeric fields.
    Any help would be highly appreciated.
    Thanks & Regards,
    Amit Kade

    Hello Sandeep,
    Thank you for the reply. I did try to do changes in RFC, I am calling a FM which gives me month names in my original RFC.
    But still the outpot of this FM is in a seperate table and anyways I will have to combine these two tables.
    Problem still remains the same.
    I tried using 'Filter' to convert date format but after applying filter my VC application is not deploying.
    Thanks,
    Amit Kade

  • Add the output from two documents on to a single spool request

    Hi All,
      I have a situation where the Remittance output using transaction F110 goes to a spool request which triggers VF31 transaction to ouput invioices, these invoices go on to a separate spool. My requirement is that all the invoices related to the Remittance should print in the same spool request after the Remittance output? Is there any method that this can be done? Would an example be possible?
    Regards,
    Puneet P.

    Hi Puneet,
    do you have access to the print program, I mean, can you change it when the open_form function is called (depends on customizing settings for this transactions)? If so, you can change the ITCPO-TDNEWID. This will cause to print the next output into the former opened one. So you first output has ITCPO-TDNEWID = 'X', the second ITCPO-TDNEWID = ' '. Then they will be merged into one.
    Cheers,
    Stefan

  • Output from same script on two different platforms produce different outputs.

    I'm running a command prompt script on two different platforms (Windows 7 desktop and a Microsoft Server 2008 R2 Enterprise platform) and the output the script produces is different on each platform.
     Specifically; the script is
           For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
           For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
           echo %mydate%>> log.txt
           echo %mytime%>> log.txt
    and the output from the Windows 7 desktop is:
           2014-07-31
           0249 PM
    While the output from the 2008 server is:
           ECHO is on.
           0249 PM

    Hi Dave,
    There's some very good learning resources here:
    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    Also, there's a script repository full of examples you can learn from and tweak to meet your needs here:
    http://gallery.technet.microsoft.com/scriptcenter
    As an additional suggestion, I'd highly recommend upgrading PowerShell on Win7 and WS2008R2 to v4. v2 was okay, but v4 makes life much easier (make sure you read the system requirements first though, there's still a few incompatibilities):
    http://www.microsoft.com/en-us/download/details.aspx?id=40855
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • What is the best way to run two programs simulataneously using the output from one to run the other?

    I just kind of wanted to get an opinion from some people on here. I have two main VIs. The first is a DAQ system that reads 99 different sensors and feeds that data into an array. The second is a real-time processing system that is designed to take the array and do numerous calculations. Both VIs output data to the front panel that I want to see, so I don't want to just use one as a SubVI.
    Is there a simple way to run both VIs, using the output from the DAQ system to feed the processor so that you can easily see the front panels of both VIs? I had considered just copying the real-time processor code into the DAQ VI, but I'm worried the resultant VI will be very large and unsightly.
    On a side note, am I over thinking this? Excuse me if this is a rather dumb question, it's been a long week...aaaand it's Wednesday.
    Solved!
    Go to Solution.

    There are a number of ways that you can go about this, but having both front panels open isn't a problem (assuming there is screen space!). Both could be sub-vi's of another "calling" vi, with their front panels set to open when called. The data from the DAQ side can be sent to the other through a number of ways, "producer-consumer" (many threads about this topic, examples in the LabVIEW examples, etc.) is one of the more robust techniques. If created correctly it allows one to run at a different rate than the other, although if the producer is "producing" much faster than the consumer can "consume" it will end up with problems.
    I guess I type too slowly
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Display PDF from BAPI's binary output

    Dear All,
    I am struck badly with this scenerio here.
    we have a Bapi which is generating an adobe form in the backend and providing that as an attribute of type binary.
    i used the following code to display that binary output, to be opened in Acrobet reader.
    byte[] pdfContent= wdContext.nodeZhra_Get_Lettertype_Desc_Input().nodeOutput().currentOutputElement().getE_Bin_File();
         IWDCachedWebResource pdfResource = WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);
         IWDWindow win = wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),"PDF in Arabic",true);
         win.setTitle("PDF in Arabic");
         win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
         win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
         win.removeWindowFeature(WDWindowFeature.MENU_BAR);
         win.removeWindowFeature(WDWindowFeature.STATUS_BAR);
         win.show();
    the problem is that the acrobet reader opens and says it could not display the file and it may be not supported or might be damaged.BUT
    1. the file is being generated and correctly displayed on another system
    2. both systems have the same version and updates of acrober reader 9.
    Kindly let me know the solution or some work-around to solve this problem. Is there a way,where i should use interactive form to do this...
    thanks in advance

    Hello!
    If it works on one client but not on the other i think it is not a Server problem.
    Check th following:
    Open the document in the Browser where it is displayed and save it on a thumbdrive and open it on the other client.
    -> If it works: it must be Browser settings
    -> If not: the generated PDF is not valid for the Adobe Reader of the other client.
    If it works on the Server but not on the client, try to dump it to a file on the Webserver to see if the BAPI call (RFC/WS) is the problem. When you use XString for exampe I think there is a problem with the data beeing split into several lines. If you have the file you should be able to open it. Compare the size of the File on the WebAS and the backend.
    Kind regards
    Matthias
    Edited by: Matthias Schneider on Nov 4, 2008 6:19 PM

  • Extracting data from a tag of  xml file which is(xml) in a  Field of Csv.

    We have a xlm script which is stored in the clob column of the csv file. we have to extract one value from the <tag> and reject remaining data.
    Sample:-
    <ROW>
    <ID>100</ID>
    <ORDER_DATE>2000.12.20</ORDER_DATE>
    <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
    <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
    <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
    <SHIPTO_STATE>CA</SHIPTO_STATE>
    <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>
    Required Output:-
    We have to extract the "500 Marine World Parkway"
    from tag <SHIPTO_STREET>
    and the above sample xml file is in one of the column which is clob datatype
    Any idea How to perform the above activity in PL/SQL ?

    As BP suggested you can use an XPATH query to extract that information from your XML. However it depends a bit on your XML data.
    Here are two examples:
    one row XML
    select extractvalue(xmltype('<ROW>
    <ID>100</ID>
    <ORDER_DATE>2000.12.20</ORDER_DATE>
    <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
    <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
    <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
    <SHIPTO_STATE>CA</SHIPTO_STATE>
    <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>')
    ,'//SHIPTO_STREET/text()') as result
    from dual;
    RESULT
    500 Marine World Parkway
    multi rows XML
    select extractvalue(column_value,'SHIPTO_STREET/text()') as result
    from table(xmlsequence(extract(xmltype('<ROWS>
    <ROW>
      <ID>100</ID>
      <ORDER_DATE>2000.12.20</ORDER_DATE>
      <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
      <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
      <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
      <SHIPTO_STATE>CA</SHIPTO_STATE>
      <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>
    <ROW>
      <ID>200</ID>
      <ORDER_DATE>2000.12.20</ORDER_DATE>
      <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
      <SHIPTO_STREET>Test</SHIPTO_STREET>
      <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
      <SHIPTO_STATE>CA</SHIPTO_STATE>
      <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>
    </ROWS>'
    ),'ROWS/ROW/SHIPTO_STREET')));
    RESULT
    500 Marine World Parkway
    Test

  • Passing binary output in servlets

    Hi all,
    I am new to struts.In Jsp i need to give three text field values
    1.category
    2.two date fields.
    On click of submit button,it should export the csv file from db into excel sheets.
    If i didnt give the input values properly and clicking the submit button will display the error msg.
    But next time if i give the proper input values,then it should disappear.
    but my problem is the err msg is not removing from jsp but export is working and in my console :
    SEVERE: Servlet.service() for servlet action threw exception+
    java.lang.IllegalStateException: Cannot forward after response has been committed*
    **and in my action class:**
    The following condition is to check existence of err:
    if (category.length() == 0 || startdate.length() == 0
                        || enddate.length() == 0) {
                   ActionMessages errors = this.getErrors(request);
                   errors.add("fatal", new ActionMessage(DATE_FIELD_MISSING, ""));
                   saveErrors(request, errors);
                   return mapping.findForward("failure");
    The following code is for export  the data:+
    if (category.equals("book")) {
                   String fileName = "part.csv";
                   response.setContentType("application/octet-stream");
                   response.setHeader("Content-Disposition", "attachment; filename=\""
                             + fileName + "\"");
                   try {
                        OutputStream oStream = response.getOutputStream();
                        oStream
                                  .write(" Number, Description, Revision, Dummy, Manual, Classification, Owner, Global Effective Date, Global Expiration Date, New Part\n"
                                            .getBytes());
                        for (int i = 0; i < result.size(); i++) {
                             PartDTO part = (PartDTO) result.get(i);
                             StringBuffer sbpart = new StringBuffer(part.getPartNumber());
                             sbpart.append(',');
                             sbpart.append(part.getPartDescription());
                             sbpart.append(',');
                             sbpart.append(part.getRevision());
                             sbpart.append(',');
                             sbpart.append(part.getIsDummy());
                             sbpart.append(',');
                             sbpart.append(part.getIsManual());
                             sbpart.append(',');
                             sbpart.append(part.getClassification());
                             sbpart.append(',');
                             sbpart.append(part.getOwner());
                             sbpart.append(',');
                             sbpart.append(part.getEffectiveDate());
                             sbpart.append(',');
                             sbpart.append(part.getExpirationDate());
                             sbpart.append(',');
                             sbpart.append(part.getIsNewPart());
                             sbpart.append("\n");
                             oStream.write(sbpart.toString().getBytes());
                        oStream.close();               } catch (IOException ioe) {
    return mapping.findForward("success");
    I think oStream.close() will return to jsp .. so the last return statement is not working..
    I dont know how to do it in someother way......Plz help me.its urgent yaar......Thanks in advance....

    It's been awhile since I've used Struts, so don't put too much stock in this answer. That said...
    Generally, you should not close the response output stream, ever. The application server takes care of this, when and if the time is right.
    Also, it appears that you're writing output within an action, and then forwarding to a JSP. If you want to write binary output or some other type of output for which a text-template based JSP is not appropriate, forward to a plain old servlet, and write your output there. Define the servlet as you would any other in web.xml, and dispatch to it from Struts instead of going to a JSP.
    Good luck!
    - Jerry Oberle

  • Multi page recordset output from ASP page on Spry Tabbed Panel Widget

    I am using a simple Spry Tabbed panel set on my asp page to show the output from different ASP pages, inside the tabbed panels. The tabbed panels on the page under consideration (destination page) display the output from different asp pages (source pages). The source asp pages generate multi page outputs which are paginated on the source page itself and pagination links are displayed on the source page itself.
    However, we dont want to display the source page outside of the tabbed panel, but instead the output content from the source asp pages should show inside the tabbeed panels only. The first page generated by the source asp page displays correctly inside the tabbed panel. However, when the user clicks on the links for the next page generated by the source asp page, but which is being displayed inside the destination page tabbed panel, they dont display the next page inside the tabbed panel. Instead the source asp page displays the output outside the tabbed panel destination  page.
    Please advise on how to ensure that the user can page through the recordset generated by the source asp page by clicking on the pagination links at the bottom of the records, while ensuring that the output displays within the tabbed panels on the destination asp page.
    I am enclosing the source code being used to generate the spry tabbed panel widget and also updating it with the output from the source asp page. In this case, the code given below is from the main page containing the widget and the source asp page is "sample.asp", which generates multi page output.
    Please note that I am not too keen on using xml data sets output from the source asp page, but would be more comfortable with directly using the asp pages to fill the tabbed panel content.
    Please help
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>
    <script language="javascript" src="/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
    <script src="/SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="/SpryAssets/SpryData.js" type="text/javascript"></script>
    <link href="/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div id="TabbedPanels1" class="TabbedPanels">
      <ul class="TabbedPanelsTabGroup">
          <li class="TabbedPanelsTab" tabindex="0" onclick="Spry.Utils.updateContent('two','sample.asp?page=' <%=i%>); Spry.Data.initRegions();" >Tab 1</li>
           <li class="TabbedPanelsTab" tabindex="0">Tab 2</li>
      </ul>
      <div class="TabbedPanelsContentGroup">
        <div id=two class="TabbedPanelsContent">Content 1</div>
        <div class="TabbedPanelsContent">Content 2</div>
      </div>
    </div>
    <script type="text/javascript">
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
    </script>
    </body>

    I fully agree that the problem does not lie with tthe tabbed panels.
    The solution would probably be first required to be tried using ajax on any div tab.
    Then the same code would have to be used on Sprytabbed panel. Hence, the following may be advised:
    1. Sample code for server side pagination and displaying inside any div tag and refreshing it using ajax. the update link would also lie inside the div tag which would show the next/ previous page without reloading the page.
    2. Then adapting the refresh technique using ajax in the Spry Tabbed panel using the inbuilt updatecontent method of the Spry Tabbed panels.
    In order to achieve the above, I am getting the recordset output in the tab content as expected. The recordset is also getting the pagination links from server side asp as required.
    However, it is also generating the following error.
    Webpage error details
    Message: Unterminated string constant
    Line: 9
    Char: 56
    Code: 0
    URI: http://localhost/test/test5.asp
    The sourcecode is as given below. If you can help with the error indicated above, my problem would probably get solved.
    <html><head>
    <title>Untitled Document</title>
    <link href="/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css">
    <script src="/SpryAssets/SpryURLUtils.js" type="text/javascript"></script>
    <script src="/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
    <script src="/SpryAssets/SpryData.js" type="text/javascript"></script>
    <script src="/SpryAssets/xPath.js" type="text/javascript"></script>
    </head>
    <body>
    <div id="TabbedPanels1" class="TabbedPanels">
      <ul class="TabbedPanelsTabGroup">
        <li class="TabbedPanelsTab" tabindex="0" onclick="Spry.Utils.updateContent('one','untitled-5.asp');">Tab 1</li>
        <li class="TabbedPanelsTab" tabindex="0" >Tab 2</li>
      </ul>
      <div class="TabbedPanelsContentGroup">
        <div id=one class="TabbedPanelsContent">Content 1</div>
        <div id ="two" class="TabbedPanelsContent">Content 2</div>
      </div>
    </div>
    <script type="text/javascript">
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
    </script>
    </body>
    </html>

  • Controlling XML Output from a Crystal Report

    Hi guys,
    I need to provide an XML output from one of my reports. The customer has defined his schema and I have tried to implement it using the 'XML Expert" With reference to the two snippets below:
    this is what I want:
    <DEPADDR>ZBTJ</DEPADDR>
        <ACFTYPE>EMB145</ACFTYPE>
    and this is what I get:
    <DEPADDR FieldName="{@DEPADDR}">ZBTJ</DEPADDR>
        <ACFTYPE FieldName="{@ACFTYPE}">EMB145</ACFTYPE>
    Does anyone know how to suppress "FieldName="{@DEPADDR}"" from the output? In the XML Expert Dialog both the name, which prints, and the type, which doesn't, are greyed out so you can't do anything with them. There is a "Suppress XML  Tag" tick box but that seems to have no effect on what is included in the export.
    Thanks in advance
    Richard

    Duplicate of
    Crystal reports with a DB procedure
    Closing and locking this thread
    Ludek

Maybe you are looking for