How to embed html tags in out.println

Hi,
i have the following code in a function in java which passes the JspWriter object
out.println("<table>");
          out.println("<tr>");
          out.println("<td>User Id</td>");
          out.println("<td>Pack Purchased </td>");
          out.println("<td>Sms Used</td>");
          out.println("<td>Sms Left</td>");
          out.println("<td>New User</td>");
out.println("</tr></table>");is what i'm doing rite? plz help.

Hi,
i' having a problem with the following code.
the web page isnt displaying anything. its just a blank page. please help
public void calculateUserDetails(JspWriter out) throws IOException
          out.println("<table border=1>");
          out.print("<tr><td>User Id</td>");
          out.print("<td>Pack Purchased </td><td>Sms Used</td>");
          out.print("<td>Sms Left</td><td>New User</td>");
          out.print("</tr>");
          Enumeration objEnumKeys = hashAllDetails.keys();
          while(objEnumKeys.hasMoreElements())
             String strHashKey = (String)     objEnumKeys.nextElement();
             UserDetails objUserDetails = (UserDetails) hashAllDetails.get(strHashKey);
             intBasicPacksTotalCount += objUserDetails.CountBasicPacks;
             intAdvancedPacksTotalCount += objUserDetails.CountAdvancedPacks;
             int intCurrentUserSoldSmsCount = getSoldSmsCountToUser(objUserDetails);
             intTotalSoldSmsCount = intTotalSoldSmsCount + intCurrentUserSoldSmsCount;
             int intCurrentUserUtilizedSmsCount = intCurrentUserSoldSmsCount - objUserDetails.SmsBalance;
             intTotalUtilizedSmsCount += intCurrentUserUtilizedSmsCount;
             intActivePacksCount += getUserActiveSMSPacksCount(objUserDetails, intCurrentUserUtilizedSmsCount);           
             int intTotalCountPackPurchased = packPurchased(objUserDetails);
            out.print("<tr><td>");
            out.print(objUserDetails.UserId);
            out.print("</td><td>Rs.");
            out.print(intTotalCountPackPurchased);
            out.print("</td><td>");
            out.print(intCurrentUserUtilizedSmsCount);
            out.print("</td><td>");
            out.print(objUserDetails.SmsBalance);
            out.print("</td>");
            boolean newFlag=NewUser(objUserDetails);
            if(newFlag==true)
                 out.print("<td>Yes</td></tr>");
            else
                 out.print("<td>No</td></tr>");
           }               //End while
           out.println("</table>");
     }     

Similar Messages

  • How to use html tags inside java

    I have to retrieve data from db and return the data to my index.jsp page.
    Its working fine.
    But I have o display in a pable format using html. How to embed html tags? I tried this way. Its not working. Any suggestions?
       String htmlOpen = "<html>";
        String htmlEnd = "</html>";
        String titleOpen ="<title>";
        String titleEnd ="</title>";
        String bodyOpen = "<body>";
        String bodyEnd = "</body>";
        for (int i = 1; i <= cols;i++){
            output = output + rsmd.getColumnName(i);
         while (rst.next()) {
            for (int i = 1; i <= cols;i++){
                      output = output +rst.getString(i);
      result = htmlOpen + titleOpen + titleEnd + bodyOpen + output+ bodyEnd + htmlEnd;
        stmt.close();
        conn.close();
         return htmlOpen;
      }

    See those charcters in your JSP that look like "<%"? Those characters mean: "the code after this is Java - interpret it as such".
    Then when you close your Java block with "%>", it then means: "the code after this is html - output it to the request response that is being built. However, within the html code, the syntax "<%= java_variable_name %>" means "take the current value of that Java variable and insert it into the html output".
    Here's an example:
    %>
    <table cellspacing="2" cellpadding="2" border="1">
    <tr>
    <%
        String s = null;
        for (int i = 1; i <= ncol; i++)
          s = rsmd.getColumnName(i);
    %>
      <th nowrap><A HREF="<%=sortLink.toString()%>&sortby=<%=s%>"><%= s %></th>
    <%
    %>
    </tr>
    <%
        if (rs == null || numRows <= 0)
          %><tr><td colspan="10" nowrap>No data available for specified query.</td></td><%
        else
          int rowCounter = 0;
          while(rs.next() && rowCounter < PAGE_SIZE)
            rowCounter++;
    %>
      <tr><%
            for (int i = 1; i <= ncol; i++)
              s = rs.getString(i);
              if (rsmd.getColumnName(i).equalsIgnoreCase("password"))
                    %><td nowrap>********</td>
    <%
              else
                %><td nowrap><%= s %></td>
    <%
            %></tr><%
    %>
    </table>This is JSP 101, what they teach in the first hour of class...
    Here's a decent JSP tutorial:
    http://www.jsptut.com/

  • How to use HTML Tags in Smartforms

    Hi,
    Can you please help me out in knowing how to use HTML tags in Smartforms,
    suppose i want to display some text in BOLD i should use the tag </b> as shown
    </b>  Header Information <b>
    regards
    Ranveer

    Hi Ranveer ,
        check this following links,
      hope this wil helps you
    <a href="http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/smartforms/smartform%20in%20abap.pdf">check this link,to know abt HTML in smartforms</a>
    rgds,
    shan

  • How to embed html into keynote

    I want to embed the youtube code for a vid into my keynote presentation so when I export to flash I can post the entire thing online, the presentation will work and I can watch the vid too. Any thoughts on how to embed html into a keynote page?
    Thanks,
    Jeremy

    The only way to get video out of Keynote that I know of, is the QuickTime export. Now, if you use another tool after that (to convert the QuickTime video) that might be able to work for you.

  • How to use HTML Tags in webdynpro java

    Hi,
         Can any body tell me how to use HTML Tags in webdynpro java.
    If u provide me with sample code it will become more usefull.
    Thanks & Regards,
    SN

    HI,
    Please find the steps:
    Create a html file and store in your webdynpro project
    Add the html contents in your file
    & Create a IFRAME UI element and refer you html file
    Now you able to see the html in webdynpro
    Thanks & Regards,
    Ram

  • How to embed html code in flash builder 4 ?

    How to embed html code in flash builder 4 ?

    Ya i tried by keeping <fx:Declarations> part but still it is throwing error,
    In flex3 we are making a component ex: <mx:canvas> and changeing that component to
    <cairngorm:ServiceLocator xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:cairngorm="com.adobe.cairngorm.business.*">
    </cairngorm:ServiceLocator>
    if any one used 4.5 with cairngorm let me know
    thanks

  • Embed HTML tag inside XSLT to generate email content

    I want to Embed HTML tag inside XSLT to generate email content .
    XSLT is not working in Jdeveloper , when i use the syntax <xsl:output method="html" indent="yes" version="1.0"/> in transformation activity .
    Can anyone help to resolve the issue .

    in the <xsl:template match=""/> element you can just start with creating your html document
    so for example
         <xsl:template match="/">
              <html>
    the graphical mapper itself won't i think but when you test the xsl it will still procedure a html document, we use it too to generate the email body contents

  • Embed HTML tag

    Hi I am toatally new to Flex. and i like RIA.
    I have a question.
    can I embed html tag into flex controls line in panel
    control?
    for example I want to use <table></table> into
    flex's 'panel' control.
    this requirement arose beacase, I have some raw code from my
    previous ajax application with simple html and javascript, and
    typically I used to use them as
    div-Id.innerHTML="<table><row><td>hello</td></tr><table>"
    i simple want to reuse my code with flex RIA
    I shall be highly oblized if anybody could help me as soon as
    possible.
    thanks
    Ravendra

    "ravendra.kumar" <[email protected]> wrote
    in message
    news:g6u91u$q06$[email protected]..
    > Hi I am toatally new to Flex. and i like RIA.
    >
    > I have a question.
    >
    > can I embed html tag into flex controls line in panel
    control?
    >
    > for example I want to use <table></table>
    into flex's 'panel' control.
    >
    > this requirement arose beacase, I have some raw code
    from my previous ajax
    > application with simple html and javascript, and
    typically I used to use
    > them
    > as
    div-Id.innerHTML="<table><row><td>hello</td></tr><table>"
    >
    > i simple want to reuse my code with flex RIA
    >
    >
    > I shall be highly oblized if anybody could help me as
    soon as possible.
    I think you'll find it easier to just work with the Flex
    version of a Table,
    which is the DataGrid.
    HTH;
    Amy

  • How to aviod html tags from Report column heading while export to csv

    Hi All,
    How to aviod html tags from Report column heading while export to excel.
    We used like Employee<br> Department in column heading, but the problem is the <br> tag also exporting into csv file.
    If any column data 3/2009 formatt the it will exporting as marh 2009.
    Please help on this.
    Thanks,
    Nr
    Edited by: pnr on Jul 5, 2011 5:00 AM

    Hi Nr
    Here is how I approached this problem.
    Go to report attributes tab
    under column attributes check PLSQL radio button.
    Create a function to return the heading of your report as shown below in your database.
    create function get_heading return clob as
    v_request VARCHAR2(20) := V('REQUEST');
    v_col_heading CLOB;
    begin
    IF INSTR(v_request,'FLOW_EXCEL_OUTPUT',1) > 0 THEN
    v_col_heading := 'Employee Number:Employee Name';
    ELSE
    v_col_heading := 'Employee breaktag Number:Employee break tag Name';
    END IF;
    return v_col_heading;
    end;
    Type the function below under ( Function returning colon delimited headings:) as follows.
    return get_heading;
    Similarly for data base it on PLSQL function body returning SQL and follow the same approach as headings.
    Hope this helps.
    Thanks
    Sukarna
    Edited by: user513776 on Jul 5, 2011 2:24 PM
    Edited by: user513776 on Jul 5, 2011 2:27 PM

  • How to Embed HTML into a Infopath form with out using the custom code???

    Hi ,
    This my first post in MSDN, so kindly ignore if there is any faults/mistakes.
    scenario:
    I am updating a HyperLink(url) to an infopath Field (Such as Rich text box /Label) from a third party workflow(Nintex),it is not able to embed the html data .is it possible to embed html controls like <a> and <Br> tags in the infopath form?????

    The InfoPath form can be configured to export some of the fields as columns... by doing so, the workflow can simply update the list item's metadata, and the value is pushed into the InfoPath form data.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • How to use HTML tags inside JSF pages

    I am creating a Menu using dataTable and outputLink in a JSF page.
    <div class="bodyarea">
    <div id="location">
    <ol>
    <h:dataTable value="#{menuItem.breadCrumb}" var="bread" >
    <h:column>
    <li>
    <h:outputLink id="crumbID" value="#{bread.menuLink}">
    <h:outputText id="crumpName" value="#{bread.menuLabel}" style="width: 165px;"/>
    </h:outputLink>
    <li>
    </h:column>
    </h:dataTable>
    </ol>
    </div>
    </div>
    I want to use <li> HTML tag as shown in code above before and after every <tr> tag formed, but when i run it and see view source, this is how it shows:
    NOTE: you can see it has thrown out of <table> tag itself.
    <div class="bodyarea">
    <div id="location">
    <ol>
    <li>
    </li>
    <table>
    <tbody>
    <tr>
    <td><a id="_id0:0:crumbID" href="/eApps/admin/loginPage.jsp?MenuItem=-1"><span id="_id0:0:crumpName" style="width: 165px;">Home</span></a></td>
    </tr>
    <tr>
    <td><a id="_id0:1:crumbID" href="/eApps/admin/loginPage.jsp?MenuItem=3~-1"><span id="_id0:1:crumpName" style="width: 165px;">HIM Admin</span></a></td>
    </tr>
    </tbody>
    </table>
    </ol>
    </div>
    </div>
    Can some one help me, how do i use HTML tags inside <h:dataTable>.
    Or is their any other way i should form my Menus, to fully utilize to HTML tags.
    Thanks
    Ravi

    Hello,
    You can embed the verbatim elements in your datatable, ie,
    <h:dataTable value="#{menuItem.breadCrumb}" var="bread" >
      <h:column>
        <f:verbatim><li></f:verbatim>
        <h:outputLink id="crumbID" value="#{bread.menuLink}">
          <h:outputText id="crumpName" value="#{bread.menuLabel}" style="width: 165px;"/>
        </h:outputLink>
        <f:verbatim></li></f:verbatim>
      </h:column>
    </h:dataTable>

  • How to remove html-tags from a text.

    Hello!
    I have a text-field which I will remove html-tag's from.
    Example:
    "This is a test<br><p> and another test"
    The function must return a similar text, but without the html-
    tags <br> and <p> (in this case).
    Anybody that can help me with this little problem?
    Thanks in advance for any help :-)
    Best regards
    Kjetil Klxve

    You can wait for some kind personal to post a complete code
    solution... But if you want to fix this yourself (which is good
    for the soul) here are some hints:
    - You can use SUBSTR to get at chunks of text
    - You can use INSTR to find particular characters.
    - You can use INSTR as an argument of SUBSTR
    Hence:
    bit_of_text := SUBSTR(text, 1, INSTR(text, '<'));
    chopped_text := SUBSTR(text, INSTR(text, '<'));
    bit_of_text := bit_of_text||SUBSTR(chopped_text, INSTR
    (text, '>'), INSTR(text, '<'));
    will give you the first bit of text that doesn't contain any
    angle brackets.
    From this you should be able to work out how to functionalised
    this (you'll need to store the offsets and use them in a loop
    construct).
    Note that this assumes that the text only contains the '<'
    character when it's part of a HTML tag. If you can't guarantee
    this then you'll have to explicitly search for all the tags e.g.
    bit_of_text := SUBSTR(text, 1, INSTR(lower(text), '<p>'));
    bit_of_text := SUBSTR(text, 1, INSTR(lower(text), '<br>'));
    This will be a bit of pain. And completely rules out XML!
    rgds APC

  • How to remove HTML tags from a String ?

    Hello,
    How can I remove all HTML Tags from a String ?
    Would you please to give me a simple example ?
    Best regards,
    Eric

    Here's some code I cooked up. I have created an object that processes code so that it can be incorporated directly into a project. There is some redundancy so that the it can be used in more than one way. Depending on your situation you might have to make the condition statement a little more sophisticated to catch stray ">" tags.
    I have also included a Tester application.
    //This removes Html tags from a String either by submitting the String during construction and then
    // calling getProcessedString() or
    // by simply calling " stringwithoutTags=removeHtmlTags(stringWithTagsSubmission); "
    //Note: This code assumes that all"<" tags are accompanied by a ">" tag in the proper order.
    public class HtmlTagRemover
         private String stringSubmission,processedString,stringBeingProcessed;
         private int indexOfTagStart,indexOfTagEnd;
         public HtmlTagRemover()
         public HtmlTagRemover(String s)
              removeHtmlTags(s);          
         public String removeHtmlTags(String s)
              stringSubmission=s;
              stringBeingProcessed=stringSubmission;
              removeNextTag();
              return processedString;
         private void removeNextTag()
              checkForNextTag();
              while((!(indexOfTagStart==-1||indexOfTagEnd==-1))&<indexOfTagEnd)
                   removeTag();
                   checkForNextTag();
              processedString=stringBeingProcessed;
         private void checkForNextTag()
              indexOfTagStart=stringBeingProcessed.indexOf("<");
              indexOfTagEnd=stringBeingProcessed.indexOf(">");
         private void removeTag()
              StringBuffer sb=new StringBuffer("");
              sb.append(stringBeingProcessed);
              sb.delete(indexOfTagStart,indexOfTagEnd+1);
              stringBeingProcessed=sb.toString();
         public String getProcessedString()
              return processedString;
         public String getLastStringSubmission()
              return stringSubmission;
    public class HtmlRemovalTester
         static void main(String[] args)
              String output;
              HtmlTagRemover h=new HtmlTagRemover();
              output="The processed String: "+h.removeHtmlTags("<Html tag>This is a test<another Html tag> string<yet another Html tag>.");
              output=output+"\n"+" The original string:"+h.getLastStringSubmission();
              System.out.print(output);

  • How to hide html tags in RSS reader

    Hello everyone!
    I need a help. I`m not a programmer, but I make a very simple RSS reader based on this tutorial http://mobile.dzone.com/articles/building-mobile-rss-reader ... Application works perfect, but I have a problem into DetailsView (rss feed item)... In this view application show me a all html tags into rss feed (or articles on my website)... Content into Description (in application) begins with <p> margin-left: 4px,.... and other html tags. Please, tell me how I set to hide this tags and show only a article content (text)..I
    I will be really greatful for any help!
    Best regards,
    Rok

    Unfortunately no, there is not. It's absolutely needed so that site studio knows how to load the pages. One thing you can do is to use SSPU (site studio publishing utility) to generate static pages and then use a scripting language, such as perl, to strip out all the site studio-specific code from those pages.
    Sorry, but that's one big downside to using site studio.

  • How to add HTML tags to 'mailto' body

    i'm trying to figure out how to add font color and bold to an
    email body.
    i have the code working properly to build the email and drop
    the text in the correct locations. however, when i try to add the
    html tags to the process, it doesn't work.
    when i use the escape command to URLencode the input, it goes
    through and you can read the html tags in the email. if i don't
    escape the text/tags, the mailto command fails completely.
    dual 2.5 g5, 10.4.8, 3gig ram, plenty storage
    flash 8pro. ripping flash8 swf, actionscripting 2.0
    here's my current code:
    emailto =
    escape("[email protected],[email protected]");
    emailsub = escape("REQUEST - order");
    tempemailbody = "<B><FONT COLOR=\"#2B6EB5\">" +
    header + "</FONT></B>other text = " + somethingelse +
    "<br>";
    emailbody = escape(tempemailbody);
    emailvar = "mailto:" + emailto + "?subject=" + emailsub +
    "&body=" + emailbody;
    getURL(emailvar, "_blank");
    please advise.
    thanks in advance
    jason
    ps. i tried adding this post twice and it didn't appear in
    the topic list. sorry if the previous ones eventually go thru

    You can't send HTML email right from Flash. You will need to
    use a
    server-side script that adds the necessary headers into the
    email.
    Dave -
    Head Developer
    www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

Maybe you are looking for

  • Not able to locate the path of adgentopfile.sh

    Hi All, I am in the process of creating a customtop. I got stuck in between because i need to run the adgentopfile.sh which i am not able to locate. bash-3.00$ cd $INST_TOP/admin/install bash-3.00$ cd /u01/oracle/ERPDEV/appldev/inst/apps/DEV_zanerpua

  • Cant connect with Ethernet at hotel

    I'm at NYC hotel. TheoOnly have ethernet in rooms. Does not work, tried two cables and I tried another room. MUst be settings. I ran through automatic and some of the drop downs in network setting -- don't understand it. They say it should all work p

  • Insert dblink table using views

    Hi all, I' using the next insert query to a dblink table: INSERT INTO dgy_doc_data@dgtry_dblk (user_id,                                      doc_xml_data,                                      created_by,                                      creation_

  • Query value

    Hello gurus, On my query, on some calculated kfs doesn't appear any value, insteade it appears *. This should have values cause the restricted kfs that contribute to this calculated kf have values... For example: calculated         * restricted1     

  • How to archive sales order

    Hi there is an issue in my proj that i have to delete sales order and reuse number again since deleting is not possible for sales order i need to archive it please suggest me any good links for this process Thanks and Regards Sunil Iyer