Displaying dynamically generated HTML

Hi!
Is it possible to display dynamically generated HTML-page by means of ITS?
I want to write report in ABAP and generate HTML-page with report data, then display it on client side.
Is it possible?
Thanks!

Hello,
As long as it has a transaction code then probably yes.  Just use the webgui service.
Edgar

Similar Messages

  • How to display dynamically generated SVG image

    Hello, I need some help on this issue...
    I need my page to display programmatically generated SVG image. but if i directly pass SVG string to the page like <h:outputText value="#{MyBean.SVGresult}"/> it will pop up a download dialog box. what should i do to properly include my svg into the page by using embed tag??

    The h:graphicImage does not appear to handle svg; maybe it should be extended. I'm still looking for the best way to do it. I don't know if I have the right solution but here is what I have done so far. This will throw up a x, y polyline graph.
    Put a panelGrid as place holder in the jsp
          <h:panelGrid  title="Report" style="color=black" border="0" id="dataReports" columns="1" binding="#{dataAnalysis.dataReport}">
          </h:panelGrid>Then take a 'template' svg and fill it in with the dynamic additions and changes in the backing bean. In a submit action
                    generateSVGGraph(twothetaArray, intensityArray);
                    UIColumn c=new UIColumn();
                    HtmlOutputText op=new HtmlOutputText();
                    op.getAttributes().put("style","color=black");
                    op.setTitle("header text");
                    op.setValue("header text");
                    c.setHeader(op);
                    //c.getFacets().put()
                    //c.getChildren().add("<embed src=\"../phase.svg\" align=\"left\" width=\"500\" height=\"500\" type=\"image/svg+xml\"/>");
                    //javax.faces.webapp.UIComponentBodyTag embed=new javax.faces.webapp.UIComponentBodyTag();
                    //javax.servlet.jsp.tagext.TagAdapter;
                    com.hypernex.jsf.ext.html.HtmlEmbedGraphic embedGraphic=new com.hypernex.jsf.ext.html.HtmlEmbedGraphic();
                    //embedGraphic.
                    embedGraphic.getAttributes().put("src","../session/phase"+phaseGraphCount+".svg");
                    embedGraphic.getAttributes().put("align","left");
                    embedGraphic.getAttributes().put("width","600");
                    embedGraphic.getAttributes().put("height","500");
                    embedGraphic.getAttributes().put("type","image/svg+xml");
                    c.getChildren().add(embedGraphic);
                     dataReport.getChildren().add(c);
                   c=new UIColumn();
                    op=new HtmlOutputText();
                    op.getAttributes().put("style","color=black");
                    op.setTitle("header text");
                    op.setValue("header text");
                    c.setHeader(op);
                    HtmlOutputText out=new HtmlOutputText();
                    out.getAttributes().put("style","color=black");
                    //out.setTitle("Figure 1.  Powder intensity as dependent on 2&theta;.");
                    out.setValue("Figure "+phaseGraphCount+".  Powder intensity as dependent on 2Theta.");
                    c.getChildren().add(out);
                    dataReport.getChildren().add(c);
    ...generateSVGGraph
        protected void generateSVGGraph(double[] x, double[] y)
            //FacesContext context = FacesContext.getCurrentInstance();
            //context.
            //Create an svg graph of the equation.
            org.apache.batik.dom.svg.SAXSVGDocumentFactory svgFactory=new org.apache.batik.dom.svg.SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
               org.apache.batik.dom.svg.SVGDOMImplementation svgDOMImplementation=new org.apache.batik.dom.svg.SVGDOMImplementation();
            org.w3c.dom.DocumentType dt=null;//svgDOMImplementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN",f.toURI().toString());
            //System.out.println(dt);
         org.w3c.dom.svg.SVGDocument svgOMDocument=null;
            try
                System.out.println("dir "+(new java.io.File(".")).toURI().toString());
                svgOMDocument=(org.w3c.dom.svg.SVGDocument)svgFactory.createDocument((new java.io.File("../webapps/jsf-wita/siteadmin/templates/graph-template.svg")).toURI().toString(), new java.io.FileInputStream(new java.io.File("../webapps/jsf-wita/siteadmin/templates/graph-template.svg")));//new org.apache.batik.dom.svg.SVGOMDocument(dt, (org.w3c.dom.DOMImplementation)svgDOMImplementation);
                org.w3c.dom.svg.SVGSVGElement root=svgOMDocument.getRootElement();
                        org.apache.batik.dom.svg.SVGOMGElement primary_g=new org.apache.batik.dom.svg.SVGOMGElement("", (org.apache.batik.dom.AbstractDocument)svgOMDocument);
                        primary_g.setAttribute("style","stroke:black; fill:none; stroke-width:1");
                        root.appendChild(primary_g);
                        //double[] x=new double[4*90];
                        //double[] y=new double[x.length];
                        //x[0]=(double)(1)/4.0;
                            //methodArgs[0]=new Double(Math.toRadians(x[0]));
                        //y[0]=((Double)method.invoke(mathmlObject, methodArgs)).doubleValue();
                        double xMin=x[0];
                        double yMin=y[0];
                        double xMax=x[x.length-1];
                        double yMax=xMax;
                        double xOfyMax=yMin;
                        StringBuffer points=new StringBuffer();
                        for(int index=0;index<x.length-1;index++)
                            //System.out.println(x[index]+" "+y[index]);
                            //x[index]=(double)(index+1)/4.0;
                            //methodArgs[0]=new Double(Math.toRadians(x[index]));
                            //y[index]=((Double)method.invoke(mathmlObject, methodArgs)).doubleValue();
                            double cx=x[index];
                            double cy=y[index];
                            //if(xMin>cx)xMin=cx;
                            if(yMin>cy)yMin=cy;
                            //if(xMax<cx)xMax=cx;
                            if(yMax<cy)
                             xOfyMax=cx;
                             yMax=cy;
                        org.w3c.dom.svg.SVGTextElement xLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("xLabel");
                        xLabel.getFirstChild().setNodeValue("2?");//?");
                        org.w3c.dom.svg.SVGTextElement xMinimumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("xMinimumLabel");
                        xMinimumLabel.getFirstChild().setNodeValue(ddf.format(xMin,4).toString());
                        org.w3c.dom.svg.SVGTextElement xMaximumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("xMaximumLabel");
                        xMaximumLabel.getFirstChild().setNodeValue(ddf.format(xMax,4).toString());
                        org.w3c.dom.svg.SVGTextElement yMinimumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("yMinimumLabel");
                        yMinimumLabel.getFirstChild().setNodeValue(ddf.format(yMin,4).toString());
                        org.w3c.dom.svg.SVGTextElement yMaximumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("yMaximumLabel");
                        yMaximumLabel.getFirstChild().setNodeValue(ddf.format(yMax,4).toString());
                        for(int index=0;index<x.length-1;index++)
                            points.append((x[index]-xMin)*500/(xMax-xMin));
                            points.append(",");
                            points.append((y[index]-yMin)*500/(yMax-yMin));
                            points.append(" ");
                        //System.out.println(points);
                        org.apache.batik.dom.svg.SVGOMGElement g=new org.apache.batik.dom.svg.SVGOMGElement("", (org.apache.batik.dom.AbstractDocument)svgOMDocument);
                        g.setAttribute("id",(String)"data");
                        g.setAttribute("transform", "translate(100, 550)");
                        g.setAttribute("style","stroke:black; fill:none; stroke-width:1");
                        org.apache.batik.dom.svg.SVGOMPolylineElement polyLine=new org.apache.batik.dom.svg.SVGOMPolylineElement("", (org.apache.batik.dom.AbstractDocument)svgOMDocument);
                        polyLine.setAttribute("fill", "none");
                        polyLine.setAttribute("stroke", "blue");
                        polyLine.setAttribute("transform", "scale(1, -1)");
                        polyLine.setAttribute("stroke-width", "1");
                        polyLine.setAttribute("points", points.toString());
                        g.appendChild(polyLine);
                        primary_g.appendChild(g);
                       javax.xml.transform.TransformerFactory tFactory = javax.xml.transform.TransformerFactory.newInstance();
                       javax.xml.transform.Transformer intermediateTransformer=tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("../webapps/jsf-wita/stylesheets/identity.xsl"));
                                    intermediateTransformer.setOutputProperty(OutputKeys.ENCODING, "iso-8859-1");
                                    intermediateTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
                         intermediateTransformer.transform(new javax.xml.transform.dom.DOMSource(svgOMDocument), new javax.xml.transform.stream.StreamResult(new java.io.FileOutputStream("../webapps/jsf-wita/session/phase"+phaseGraphCount+".svg")));
            catch(javax.xml.transform.TransformerConfigurationException tce)
                System.out.println("tce err: "+tce.getMessage());
            catch(javax.xml.transform.TransformerException te)
                System.out.println("te err: "+te.getMessage());
            catch(java.io.FileNotFoundException fnfe)
                System.out.println("fnfe:"+fnfe.getMessage());
            catch(java.io.IOException ioe)
                System.out.println("io:"+ioe.getMessage());
        HtmlEmbedGraphic.java
    * HtmlEmbedGraphic.java
    * Created on May 16, 2004, 8:12 AM
    package com.hypernex.jsf.ext.html;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    * @author  hyperdev
    public class HtmlEmbedGraphic extends javax.faces.component.UIComponentBase
        /** Creates a new instance of HtmlEmbedGraphic */
        public HtmlEmbedGraphic()
            super();
        public String getFamily()
            return "javax.faces.Data";
        public boolean isRendered()
            return true;
    public void encodeBegin(FacesContext context,
      UIComponent component) throws java.io.IOException {
      if ((context == null) || (component == null)){
          System.out.println("encodeBegin NullPointerException "+context);
        throw new NullPointerException();
          System.out.println("encodeBegin "+context+" "+component);
      //MapComponent map=(MapComponent) component;
      ResponseWriter writer = context.getResponseWriter();
      writer.startElement("embed", this);
      writer.writeAttribute("src", getAttributes().get("src"),"id");
    public void encodeEnd(FacesContext context) throws java.io.IOException {
      if ((context == null)){
        throw new NullPointerException();
      //MapComponent map = (MapComponent) component;
      ResponseWriter writer = context.getResponseWriter();
      writer.startElement("embed", this);
      writer.writeAttribute("src", getAttributes().get("src"),"id");
      writer.writeAttribute("align", getAttributes().get("align"),"id");
      writer.writeAttribute("width", getAttributes().get("width"),"id");
      writer.writeAttribute("height", getAttributes().get("height"),"id");
      writer.writeAttribute("type", getAttributes().get("type"),"id");
      writer.endElement("embed");
    }graph-template.svg - More static parts of the graphic can be put in here.
    <?xml version="1.0" encoding="UTF-8"?>
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="text/ecmascript" width="100%" zoomAndPan="magnify" contentStyleType="text/css" viewBox="0 0 600% 600%" height="100%" preserveAspectRatio="xMidYMid meet" version="1.0">
    <g style="stroke:black; fill:none; stroke-width:1">
    <g id="visuals" style="stroke:black; fill:none; stroke-width:1" transform="translate(100, 550)">
    <rect id="box" transform="scale(1, -1)" x="1" y="1" width="500" height="500" fill="none" stroke="black" stroke-width="1.5"/>
    <g id="labels" transform="scale(1, 1)">
    <text id="xLabel" x="250" y="50" text-anchor="middle"
            font-family="Verdana" font-size="24" fill="blue" >x label</text>
    <text id="xMinimumLabel" x="0" y="20" text-anchor="middle"
            font-family="Verdana" font-size="18" fill="blue" >0.0</text>
    <text id="xMaximumLabel" x="500" y="20" text-anchor="middle"
            font-family="Verdana" font-size="18" fill="blue" >100.0</text>
    <text id="yMinimumLabel" x="-3" y="-3" text-anchor="end"
            font-family="Verdana" font-size="18" fill="blue" >0.0</text>
    <text id="yMaximumLabel" x="-3" y="-500" text-anchor="end"
            font-family="Verdana" font-size="18" fill="blue" >100.0</text>
    </g>
    </g>
    <g id="data" style="stroke:black; fill:none; stroke-width:1" transform="translate(10, 550)">
    </g>
    </g>
    </svg>

  • Cross column radio group solution using dynamically generated HTML

    I am tasked with creating a screen in Apex matching look and feel of an existing application screen; tabular form, multiple column radio buttons to update a single column value (radio group needs to be row oriented, across multiple columns). I could not find a way to use HTMLDB_ITEM.RADIO_GROUP () function for this due to the radio group being column based, great as a row selector but not for use across columns (each button being a column).
    My first thought was to comprise and use checkboxes via HTMLDB_ITEM.CHECKBOX () for the multiple choices (in each column) and HTMLDB_ITEM.HIDDEN() to hold the chosen value, a JavaScript function for “onClick” event to make the checkboxes in one row act like radio buttons in a radio group. I created a simple application to show the concepts of my solutions …
    SQL looks like this:
    select pk_id, -- f01
    object_to_color, -- f02
    HTMLDB_ITEM.CHECKBOX(11, color_choice,
    'onClick="chkboxAction('||pk_id||', document.wwv_flow.f11, ''RED'')"', 'RED') red,
    HTMLDB_ITEM.CHECKBOX(12, color_choice,
    'onClick="chkboxAction('||pk_id||', document.wwv_flow.f12, ''BLUE'')"', 'BLUE') blue,
    HTMLDB_ITEM.CHECKBOX(13, color_choice,
    'onClick="chkboxAction('||pk_id||', document.wwv_flow.f13, ''GREEN'')"', 'GREEN') green,
    color_choice -- f03
    from objects_to_color
    Columns pk_id and color_choice are set as Show off and Display As Hidden. Note that my HTMLDB_ITEM.CHECKBOX items start with id number 11 (f11 – f13) so as not to conflict with the item id’s Apex will generate on it’s own. I could have used HTMLDB_ITEM functions to create all items and had my own PL/Sql update process.
    This creates a tabular presentation with a column for each color choice as a checkbox, shown checked if that color is initially set.
    The JavaScript function chkboxAction() clears the other checkboxes if a color is selected and stores the color in the hidden item db column for use in Apex Submit processing. Sorry the identation get's lost in the post!
    function chkboxAction (id, ckbx, color) {
    // f01 is pk_id (hidden)
    // f11 is RED checkbox
    // f12 is BLUE checkbox
    // f13 is GREEN checkbox
    // f03 db column color_choice for update (hidden)
    var idx;
    // Find row index using pk_id passed in as id argument.
    for (var i=0; i < document.wwv_flow.f01.length; i++) {
    if (document.wwv_flow.f01.value == id) {
    idx = i;
    i = document.wwv_flow.f01.length;
    if (ckbx(idx).checked == true) {
    // Set hidden color_choice column value to be used in update.
    document.wwv_flow.f03(idx).value = color;
    // Uncheck them all, then reset the one chosen.
    document.wwv_flow.f11(idx).checked = false;
    document.wwv_flow.f12(idx).checked = false;
    document.wwv_flow.f13(idx).checked = false;
    ckbx(idx).checked = true;
    } else {
    // Unchecked so clear color_choice column value to be used in update.
    document.wwv_flow.f03(idx).value = '';
    This works well and, as an aside, has an added feature that the color can be “unchosen” by unchecking a checked checkbox and leaving all checkboxes unchecked. This cannot be done with radio buttons unless a radio button is added as “no color”.
    But what if radio buttons must be used, as in my situation? Here is another solution using custom code to dynamically generate radio buttons for a row based radio group rather than using HTMLDB_ITEM.RADIO_GROUP ().
    select pk_id, -- f01
    object_to_color, -- f02
    '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_1" value="RED" '||
    decode(color_choice, 'RED', 'CHECKED', '')||
    ' onClick="rbAction('||pk_id||', ''RED'')">' red,
    '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_2" value="BLUE" '||
    decode(color_choice, 'BLUE', 'CHECKED', '')||
    ' onClick="rbAction('||pk_id||', ''BLUE'')">' blue,
    '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_3" value="GREEN" '||
    decode(color_choice, 'GREEN', 'CHECKED', '')||
    ' onClick="rbAction('||pk_id||', ''GREEN'')">' green,
    color_choice -- f03
    from objects_to_color
    The pk_id column is used here to ensure a unique name and unique id for the items. In practice a custom api should be used to generate items in this way.
    The JavaScript function is actually simpler for radio buttons because the radio group handles the mutually exclusive logic for choosing a color.
    function rbAction (id, color) {
    // f01 is pk_id (hidden)
    // f03 db column color_choice for update (hidden)
    var idx;
    // Find row index using evaluation_question_id.
    for (var i=0; i < document.wwv_flow.f01.length; i++) {
    if (document.wwv_flow.f01.value == id) {
    idx = i;
    i = document.wwv_flow.f01.length;
    // Set hidden result column referenced in update.
    document.wwv_flow.f03(idx).value = color;
    Now the problem is that on update, Apex will be confused by the custom items and try to post updated values to it’s own internal items – which don’t exist. The result is the very frustrating HTTP 404 - File not found error when apex/wwv_flow.accept executes on Submit. So, the trick is to clear the custom items prior to the update with a simple JavaScript function, then the values show again when the page is rerendered, if you are not branching from the page. The Submit button is changed to call the following function:
    function submit () {
    var items = document.getElementsByTagName("INPUT");
    for (i=0; i< items.length; i++) {
    if (items(i).type == "radio") {
    if (items(i).checked == true)
    items(i).checked = false;
    doSubmit('SUBMIT');
    This technique might have general use when using custom items. Comments or improvements on this?
    See Oracle Apex site: workspace SISK01, app OBJECTS_TO_COLOR

    Just the code for formatting.
    Checkboxes to behave like radio group ...
    SQL ...
    select pk_id,              -- f01
           object_to_color,    -- f02
              HTMLDB_ITEM.CHECKBOX(11, color_choice,
                  'onClick="chkboxAction('||pk_id||', document.wwv_flow.f11, ''RED'')"', 'RED') red,
              HTMLDB_ITEM.CHECKBOX(12, color_choice,
                  'onClick="chkboxAction('||pk_id||', document.wwv_flow.f12, ''BLUE'')"', 'BLUE') blue,
              HTMLDB_ITEM.CHECKBOX(13, color_choice,
                  'onClick="chkboxAction('||pk_id||', document.wwv_flow.f13, ''GREEN'')"', 'GREEN') green,
           color_choice  -- f03
    from objects_to_colorJavaScript ...
    function chkboxAction (id, ckbx, color) {
        // f01 is pk_id (hidden)
        // f11 is RED checkbox
        // f12 is BLUE checkbox
        // f13 is GREEN checkbox
        // f03 db column color_choice for update (hidden)
        var idx;
        // Find row index using pk_id passed in as id argument.
        for (var i=0; i < document.wwv_flow.f01.length; i++) {
           if (document.wwv_flow.f01(i).value == id) {
              idx = i;
              i = document.wwv_flow.f01.length;
        if (ckbx(idx).checked == true) {
          //  Set hidden color_choice column value to be used in update.
          document.wwv_flow.f03(idx).value = color;
          // Uncheck them all, then reset the one chosen.
          document.wwv_flow.f11(idx).checked = false;
          document.wwv_flow.f12(idx).checked = false;
          document.wwv_flow.f13(idx).checked = false;
          ckbx(idx).checked = true;
        } else {
          //  Unchecked so clear color_choice column value to be used in update.
          document.wwv_flow.f03(idx).value = '';
    }Radio button solution ...
    SQL ...
    select pk_id,              -- f01
           object_to_color,    -- f02
           '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_1" value="RED" '||
                decode(color_choice, 'RED', 'CHECKED', '')||
                ' onClick="rbAction('||pk_id||', ''RED'')">' red,
           '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_2" value="BLUE" '||
               decode(color_choice, 'BLUE', 'CHECKED', '')||
               ' onClick="rbAction('||pk_id||', ''BLUE'')">' blue,
           '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_3" value="GREEN" '||
               decode(color_choice, 'GREEN', 'CHECKED', '')||
               ' onClick="rbAction('||pk_id||', ''GREEN'')">' green,
           color_choice  -- f03
    from objects_to_colorJavaScript ...
    function rbAction (id, color) {
        // f01 is pk_id (hidden)
        // f03 db column color_choice for update (hidden)
         var idx;
         // Find row index using evaluation_question_id.
        for (var i=0; i < document.wwv_flow.f01.length; i++) {
           if (document.wwv_flow.f01(i).value == id) {
              idx = i;
              i = document.wwv_flow.f01.length;
        //  Set hidden result column referenced in update.
        document.wwv_flow.f03(idx).value = color;
    function submit () {
      // Clears radio buttons to prevent Apex trying to post and causing page error.
      var items = document.getElementsByTagName("INPUT");
      for (i=0; i< items.length; i++) {
        if (items(i).type == "radio") {
          if (items(i).checked == true)
            items(i).checked = false;
      doSubmit('SUBMIT');
    }

  • Dynamically generate HTML at runtime

    I've tried looking for an existing project that does this or something similar already, but the closest I got was an eclipse plug-in by IBM, which wont really help me since it wont work at runtime.
    Basically I want to be able to generate a HTML form dynamically, based on the XML in a WSDL. Anyone got any ideas?

    Wow, no one? Damn, must be harder than I thought.No, it's really not hard at all. At least generating HTML isn't hard. What IS hard is answering your question. You have already rejected some alternatives, but you don't tell us what they were or why you rejected them. So I could suggest you use XSLT, but I might be wasting my time because you already rejected that. Or you might have had a completely bogus reason for rejecting it, but I can't tell.
    So basically that's why you didn't get any answers. Not enough information to base an answer on, and enough information to decide not to answer.

  • How to display xslt generated html code?

    Hi,
    I transformed xml code into html code inside my action
    class and put generated code into StringWriter, I
    don't
    know how I can display it on my jsp page?
    I tried to turn generated html code into a big string,
    then use bean:write to display it on jsp page, it just
    does not work.
    Has anyone done this kind of thing?
    thanks

    hi
    Just put that String in JSP expression <%= String name %>
    u will see it on browser
    thanks
    hithesh

  • How to dynamically generate HTML in Servlet without all the out.println?

    Since I am not sure whether this is a Java Servlet or JSP problem, so I will describe my situation. And hopefully someone can propose a good solution. I came from a PHP, so Java Servlet and JSP are still a little bit foreign for me.
    My problem
    My front end is a JSP page that essentially contains a form (let’s call it form1). The reason it is a JSP not a HTML is because I will need to load form data from the backend and display them in the form. Once the user submits the form, it will go to a backend Java Servlet (let’s call it servlet 1), which loads data from files according to user input. Then, I will need to dynamically create a new form (let’s call it form2) based on the data loaded from files. Once the user inputs and submits form2, another Java Servlet (servlet 2) will do more processing. That is the end of line. Both form1 and form2 require Javascript.
    My question is that since servlet 1 will need to dynamically create form2. I naturally will want a presentation control. Instead of doing out.println(“html code”), I want to use JSP and write direct HTML code. On the other hand, can JSP be used as a form action? So basically, in form 1, can I do <form action=”…/xxx.jsp”> I think I saw something like this, but I lack the comprehensive JSP knowledge to know for sure. More importantly, if hypothetically JSP can be used, how do I handle functions such as doGet(HttpServletRequest request, HttpServletResponse response), which is used in servlet1.
    Thank you,
    M

    no, servlets should not be used to generate a view, that is what a JSP is for. So let your backend servlet fetch the data, put it for example as attributes of the request scope (request.setAttribute()) and then forward control to a JSP that will generate the view, based on the information you stored in the request scope. That is the proper way of using servlets & JSPs; use servlets to invoke business logic classes, use JSPs combined with JSTL to generate the view. If you do it properly, you don't need ANY java code in your JSP.

  • Dynamically Generated HTML/PDF/RTF?

    Hi guys,
    This is similar to something I asked recently, but I've got a better idea of what I need and how to ask. I'm still fairly novice at programming, espeically applets.
    I'm working on an applet for an educational purpose that will generate an array of study items...probably 30-50, I haven't decided on the size yet. It's for foreign language study, and the items are foreign phonetic characters, no more than 3 per item. I'd like to output them in a print-ready format, probably essentially a grid, with some space for the student to write their answer next to or under it. I've seen some free libraries out there that can generate pdf, rtf, and HTML, most notably the iText libraries.
    I really want to do this as an applet. So my question is, how would this, or another library that one of you knows that would be better, be implemented? Would the output be a file on the server? Is there a way to make it generate the file to the users local cache or something, or give them an option to download it without it going on a server, since it is randomly generated and not uniform for other users? (I assume that would require making it a signed applet?)
    Any help you can give would be really appreciated.
    Colin

    cosmic_cow wrote:
    Okay, but this would work very well as a web application.What's a good resource for learning to work with them as opposed to applets? (Told you I'm a novice! ) Well, if you're a novice it might be better to concentrate on the regular Java stuff and sure, applets too.
    Then if you feel interested in Java EE and Web Applications and Databases and what not, you can check out this to see what Enterprise Java consists of.

  • Use of WHERE clause to get 2 columns from dynamically generated html page.

    I am using postgresql.I have to complete a java program , which is a forum like thing.User can login and submit question.....if anybody know the answer he can post the answer........Now the problem is that if more than one questions are entered it all should be displayed when we click on a "faq" button.........i created that one......these questions have the hyperlink.........When we click on a single question a text box will come........we have to write the answer there and answer should lie on the column corresponding the question clicked..............
    Here i need the querry to write in servlet so that the answer is stored in the corresponding column only.................
    Pleaseeeeeeeeeeeee help me as soon as possible..................
    Regards
    Shine..

    Sir,
    Other than you are using postgres and a servlet I have absolutley no idea what you are on about.
    Please try explaining in a less distressing manner.
    Sincerely,
    Slappy

  • How to display  servlet dynamically generated image ?

    Hi,
    How to display servlet dynamically generated image ?
    I have a servlet generating a buffered image in the doGet. I want to display the image in a jsp page with other information. I'm not able to get it properly displayed.
    **Try n# 1 **************************************************************
    This displays my image but nothing elle :
    ServletOutputStream sos = pResponse.getOutputStream();
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
    encoder.encode(img);
    **Try n# 2 ****************************************************************
    I tried also :
    In the servlet :
         request.setAttribute("renderedImage", img);
    and in the jsp page :
         BufferedImage image = (BufferedImage) request.getAttribute("renderedImage");
         <img src="<%=ImageIO.write(image,"jpeg",response.getOutputStream())%>" width="300" height="280"/>
    This last try draws big crap in the jsp page, thank you in advance.
    Nelson

    Call another servlet from the IMG tag. Have the servlet stream out the image using ImageIO (instead of writing HTML).

  • How to display or generate PDF417 barcode dynamically in PDF form? I am using Acrobat XI Professional and there is a Bar Code Field in the same through which I generated the same. But I want to generate the same dynamically.

    How to display or generate PDF417 barcode dynamically in PDF form? I am using Acrobat XI Professional and there is a Bar Code Field in the same through which I generated the same. But I want to generate the same dynamically.

    What do you mean by dynamically? When yo set up a 2D bar code field you specify which field name/value pairs you want to include, along with other parameters. But be aware that they won't work with Reader unless you Reader-enable the document with LiveCycle Reader Extensions and include the bar code usage right. It will work with Acrobat Standard/Pro.

  • Using javascript to dynamically generate the html for a  Spry table

    I have some javascript which generates html code for a Spry
    table which displays the content of a Spry data set. The problem is
    that after I generate the html, Spry never fills in the values for
    the table.
    Here's what I'm doing:
    Using a data set observer, check for onPostLoad and generate
    the html code
    Using innerHTML, stuff the code into the appropriate
    <div>
    Use regionName.updateContent() to update the region I just
    created with the html code I generated
    Interestingly, if I take the generated source for my page and
    remove the data set observer, the Spry table displays correctly
    with all the expected values. This suggests to me that my generated
    html code is correct, but that there is some sort of timing issue
    (i.e. Spry doesn't know about the new code I generated).
    Any suggestions?

    jalperin wrote:
    > Here's what I'm doing:
    >
    Using a data set observer, check for
    onPostLoad and generate the html
    > code
    >
    Using innerHTML, stuff the code into
    the appropriate <div>
    >
    Use regionName.updateContent() to
    update the region I just created
    > with the html code I generated
    >
    > Interestingly, if I take the generated source for my
    page and remove the data
    > set observer, the Spry table displays correctly with all
    the expected values.
    > This suggests to me that my generated html code is
    correct, but that there is
    > some sort of timing issue (i.e. Spry doesn't know about
    the new code I
    > generated).
    >
    > Any suggestions?
    I'd guess that it is a timing issue as well. I haven't looked
    much at the dataset capability in Spry, but it may be that the
    dataset "finds" all of the regions and code that it applies to
    before the onPostLoad event is triggered. If that is the case, then
    your generated code doesn't exist yet,and so the dataset thinks
    that there is nothing for it to apply to.
    Will the HTML that you generate change based upon the dataset
    that is actually returned? I guess I'm looking for the reason why
    the HTML is being generated when it could be in the page itself and
    avoid this issue completely.
    Danilo Celic
    |
    http://blog.extensioneering.com/
    | WebAssist Extensioneer
    | Adobe Community Expert

  • How to display Report tile html Title on generated report

    Hi
    Could you please give some idea to display Report tile <html Title> on generated report?
    I am not using CrystalReportViewer to export my report
    reportClientDocument = new ReportClientDocument();
    reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);
    reportClientDocument.open(reportName, OpenReportOptions._openAsReadOnly);
    reportClientDocument.getDatabaseController().setDataSource(
    POJOList, Class.forName(CLASSNAME), TABLE_ALIAS, TABLE_ALIAS);
    byteArrayInputStream = (ByteArrayInputStream) reportClientDocument
    .getPrintOutputController().export(ReportExportFormat.PDF);
    Currently its displaying struts action name as title.
    We are using crystal reports 2008
    Thank you

    Try the following extract of code to set the title:
    SummaryInfo newSummaryInfo = new SummaryInfo(reportClientDocument.getReportDocument().getSummaryInfo());
    newSummaryInfo.setTitle("<new reportName>");
    reportClientDocument.modifySummaryInfo(newSummaryInfo);
    reportClientDocument.save();
    reportClientDocument.close();
    I hope this helps.
    Regards.
    - Robert

  • Query in Servlet not displaying results in html table

    Hi,
    I am aware that putting html in a servlet is not good practice. In my case, it is just for testing purposes.
    Environment: WLS 12c on Windows, DB 11.2.0.3
    I created an html form and a servlet in a Dynamic Web Project. The form parameters are sent to the servlet,
    but the results are not being displayed.
    HTML form:
    <input text name="p_1"
    Servlet:
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.PrintWriter;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    * Servlet implementation class QueryServlet
    @WebServlet("/QueryServlet")
    public class QueryServlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
         * @see HttpServlet#HttpServlet()
        public QueryServlet() {
            super();
            // TODO Auto-generated constructor stub
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            Connection conn = null;
            Statement stmt = null;
            try {
                conn = DriverManager.getConnection("jdbc:oracle:thin:@home-server:1521:val01", "USER", "PW");
                stmt = conn.createStatement();
    String sqlStr = "SELECT....
    ... WHERE p_1 =
    +  "'" + request.getParameter("p_1") + "'"
    out.println("<html><head><title>Query Results</title></head><body>");
                out.println("<p>Your query is: " + sqlStr + "</p>");
                out.println("<p>Your are connected to: " + conn + "</p>");
    --> OUTPUT ONLY UNTIL HERE <--           
                // Get data
                ResultSet rset = stmt.executeQuery(sqlStr);
                int count = 0;
                while(rset.next()){
                    int cid  = rset.getInt("CID");
    // Display data in html table
    out.println("<table>");
                    out.println("<tr>");
                    out.println("<td>" + cid + "</td>");
    rset.close();
                out.println("<p>====== " + count + " records found =======</p>");
                out.println("</body></html>");
                 catch (SQLException ex) {
                    ex.printStackTrace();
                    finally {
                        out.close();
                        try {
                            if (stmt != null) stmt.close();
                            if (conn != null) conn.close();
                        } catch (SQLException ex) {
                            ex.printStackTrace();
    Help greatly appreciated. Thanks!

    Possibly, the js file is not being detected by the javascript runtime.It would be better if you tried something like :
    ("<script src="<%=request.getContextPath()%>/WEB-INF/classes/ua.js"></script>

  • Displaying Text as HTML in the UIscrollbar component

    Greetings.
    I have a window on my Flash stage that has some scrollable copy in it.  The problem is, I can't seem to have any formatting for the text ... if I select a word or two to make bold, it all turns bold.  I gather I need to use the "Display Text as HTML" checkbox and then paste in some HTML formatted text but this doesn't seem to work.  I searched this forum and found that others were designating "htmlText" in Actionscript instead of just "text" ... that didn't work either.  I probably just did it wrong, or maybe it's becuase I'm using the UI component "UIscrollBar" for it's scrolling of the text.
    Is there anything else I need to do to be able to format some text with strong tags and maybe some href links?
    I have my properties inspector with the following check marks:
    Display as HTML
    Multiline
    Dynamic Text
    selectable
    Thanks everyone.

    Shamelss bump

  • Problem with Servlet that generates HTML

    Hello,
    I have a servlet that connects to a database to get some information which it displays in a HTML file generated by the same servlet.
    For each line that I want to display from the Database I create the following in my servlet:
    <input type="hidden" value="Ajax-Chelsea" name="bet_1_choice"/>
    However, when I test it in Tomcat it doesn't work, and I realised in Firefox that it gets the above line as follows with the bold part added:
    <input type="hidden" )="" value="Ajax-Chelsea" name="bet_1_choice"/>
    I also use a javascript to add the DB information in another area of the HTML page, another table, but I don't know if this is relevant.
    I don't understand what is wrong. Can someone help me please?

    Thanks for your responses.
    Actually the problem was my javascript. Now it is sorted out.

Maybe you are looking for

  • Exporting large report to Excel format (90K lines)

    Hi, I am trying to export a 90K line report to excel format and I get that error messsage: Description : Une erreur d'application s'est produite sur le serveur. Les paramètres d'erreur personnalisés actuels pour cette application empêchent l'affichag

  • How to map sold to party from crm to r/3

    If you create a BP as sold to party role and if we use that in one of the transactions in CRM and if that transaction is distributed to R/3 , we will get a new Sold to party number.Now how can we map the BP we gave in CRM with the one present in R/3.

  • IMac 24" Aluminum screen dims like notebook

    So this is kinda weird. For some reason if I do not do anything for a minute (move mouse, touch keyboard) the screen dims like on the notebooks when they try to save power. Something tells me this isn't right... Anyone have any ideas or experiencing

  • Cannot view trailers

    I keep getting the error message on Apple TV2, "An error occured loading this content.  Try again later," when trying to view trailers.  How can this be eliminated?

  • Photo album location

    I changed the location of "My Picutres" location cause the c drive was gettting too low. I updated the registry with the current location and that works fine through explorer. I just noticed after I created a new photo album that itunes is still goin