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>

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 add raw HTML tags inside JSF tags...

    Hi
    I would like to use <input type = text > inside my project in some area..The following code hides the input = type html tag and forwards the click event to jsf command button...After selecting the file,it should forward the value to jsf textfield....
    My code seems as below.
    <h:form id="detailForm" onsubmit="printElements(detailForm,this)">
    <f:verbatim>
    <input id="uploadFile" type="file" style ="dispaly:none"size="100" />
    </f:verbatim>
    <h:inputText id="docName" style="width:650px;" maxlength="100"/>
    <h:commandButton id="visibleBrowseButton" value="Select File..." onclick="'detailForm:uploadFile'.click();callClick();">
    </h:commandButton>
    </h:form>
    <script type="text/Javascript">
    function callClick()
    var val = document.detailForm.uploadFile.value;
    document.getElementById('detailForm:docName').value = val;
    </script>
    While running this page it works fine in IE but in Mozilla firefox it troubles me during detailForm:uploadFile'.click().
    I suspect the jsf page cannot able to detect the raw html tag inside jsf tags...Eventhough i tried using inside<f:verbatim> it wont works..
    I would like to know
    1.Whether the code is right,,if the code goes wrong why it got runned in IE not in firefox....
    2.How can raw html tags can be integrated inside JSF tags....

    First of all, why are you ignoring valuable answers about a JSF fileupload component in your previous topic?
    Second, you can just nest raw HTML anywhere in your JSF page. Your problem is rather related to JavaScript. It has completely nothing to do with Java nor JSF. Learn JavaScript -there is a nice tut at w3schools.com- and look for a JavaScript forum if you still stucks. There are ones at webdeveloper.com and dynamicdrive.com.
    The f:verbatim is only required if you was using JSF 1.1 or older, which is not the case. You would have occurred completely different problems.

  • 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 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 use j query in .jsf page which is designed using adfpagetemplate.

    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <af:document title="untitled7.jsf" id="d1">
    <af:form id="f1">
    <af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx" id="pt1">
    <f:facet name="center">
    <af:resource type="javascript"
    source="/lib/jquery/jquery-1.3.2.min.js"/>
    <af:resource type="javascript">
    function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next = $active.next().length ? $active.next() : $('#slideshow img:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
    $active.removeClass('active last-active');
    $(function() {
    setInterval( "slideSwitch()", 15000 );
    </af:resource>
    <af:resource type="css">
    #slideshow IMG {
    position:absolute;
    top:0;
    left:0;
    z-index:8;
    opacity:0.0;
    #slideshow IMG.active {
    z-index:10;
    opacity:1.0;
    #slideshow IMG.last-active {
    z-index:9;
    </af:resource>
    <af:panelGroupLayout id="slideshow" layout="vertical">
    <!-- The use of groups avoids that each image gets surrounded by a div -->
    <af:group>
    <af:image source="/images/cristo1.jpg" id="i1" />
    <af:image source="/images/cristo2.jpg" id="i2"/>
    <af:image source="/images/ipanema1.jpg" id="i3"/>
    </af:group>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="header"/>
    <f:facet name="end"/>
    <f:facet name="start"/>
    <f:facet name="branding"/>
    <f:facet name="copyright"/>
    <f:facet name="status"/>
    </af:pageTemplate>
    </af:form>
    </af:document>
    </f:view>
    Above content is my code written in jsf page....
    jquery working fine if i create page withoput pagetemplate...
    Any please guide me to use jquery in the jsf page(created with page template)...
    Thanks in advance
    Edited by: 991543 on May 7, 2013 11:05 PM

    Hi frank,
    thanks for your reply frank........still am facing the same issue even i tried wat you told.
    I have pasted the code below for your reference.....
    please let me knw wat is the wrong thing in below code if any thing wrong plz guide me to resolve because this is needed in our project, thanks in advance.
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <af:document title="untitled7.jsf" id="d1">
    <af:form id="f1">
    <af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx" id="pt1">
    <f:facet name="center">
    <af:resource type="javascript"
    source="/lib/jquery/jquery-1.3.2.min.js"/>
    <af:resource type="javascript">
    function slideSwitch() {
    var $active = $('#pt1:slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#pt1:slideshow IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next = $active.next().length ? $active.next() : $('#pt1:slideshow img:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
    $active.removeClass('active last-active');
    $(function() {
    setInterval( "slideSwitch()", 1000 );
    </af:resource>
    <af:resource type="css">
    #pt1:slideshow IMG {
    position:absolute;
    top:0;
    left:0;
    z-index:8;
    opacity:0.0;
    #pt1:slideshow IMG.active {
    z-index:10;
    opacity:1.0;
    #pt1:slideshow IMG.last-active {
    z-index:9;
    </af:resource>
    <af:panelGroupLayout id="slideshow" layout="vertical">
    <!-- The use of groups avoids that each image gets surrounded by a div -->
    <af:group>
    <af:image source="/images/cristo1.jpg" id="i1" />
    <af:image source="/images/cristo2.jpg" id="i2"/>
    <af:image source="/images/ipanema1.jpg" id="i3"/>
    </af:group>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="header"/>
    <f:facet name="end"/>
    <f:facet name="start"/>
    <f:facet name="branding"/>
    <f:facet name="copyright"/>
    <f:facet name="status"/>
    </af:pageTemplate>
    </af:form>
    </af:document>
    </f:view>
    Thanks & Regards
    Gowthaman Narayanan
    Edited by: 991543 on May 15, 2013 4:27 AM
    Edited by: 991543 on May 15, 2013 4:30 AM

  • How to use frames in a jsf page

    hi all,
    I need my page to be divided into three frames each frame with scrollable option. Each page should be able to display different jsp pages.Can anyone give a solution how can i implement this in a jsf page
    regards,
    Prasant

    Hello Prasant,
    I think page fragments is what your after, one of the Sun guys did a good blog on page layout with jspf but i can't access the weblogs, but you could try this tutorial in the meantime:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/pagefragments.html
    Then search the weblogs when its available. i hope this helps
    Cheers
    Gaz

  • How to use html Tags from MySQL with PHP

    I like HTML tags like <b>bold</b> or <BR>
    and others placed in the MySQL database and used by PHP to show up
    in my pages but I don't succeed. I tryied HTML encode
    (htmlentities) from the bindings POP-up menu but nothing happened.
    What is the way this should be acomplished and where is HTML
    encode (and the others in the pop-up menu) being used for?
    Any help will be appreciated,
    Jos

    arnhemcs wrote:
    > I like HTML tags like
    bold or <BR> and others placed in the MySQL
    > database and used by PHP to show up in my pages but I
    don't succeed. I tryied
    > HTML encode (htmlentities) from the bindings POP-up menu
    but nothing happened.
    Just store the HTML as plain text in your database. Using
    htmlentities()
    turns < into &lt; and so on. Using it is what's
    preventing your HTML
    from displaying correctly.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • Use jstl tags in jsf page

    I have h:dataTable in each row of which i'd like to output row data as text, inputfield or link depending on row data type
                        <h:dataTable id="pnlHistory" value="#{UserOrdersBean.orderLineWrappers}" var="wrapper" rendered="#{UserOrdersBean.isBasicUser}"
                                     columnClasses="history_col1, history_col2, history_col3, history_col4, history_col5" width="100%" cellpadding="5" >
                            <h:column>
                                <f:facet name="header">
                                    <h:commandLink action="doRefresh" actionListener="#{UserOrdersBean.doSort}">
                                        <h:outputText value="#{msg.userorders_itemName}">
                                            <f:param value="orderLineWrappers"/>
                                            <f:param value="itemName"/>
                                        </h:outputText>
                                    </h:commandLink>
                                </f:facet>
                                <h:outputText value="#{wrapper.itemName}" styleClass="itemdescription"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:commandLink action="doRefresh" actionListener="#{UserOrdersBean.doSort}">
                                        <h:outputText value="#{msg.userorders_data}">
                                            <f:param value="orderLineWrappers"/>
                                            <f:param value="data"/>
                                        </h:outputText>
                                    </h:commandLink>
                                </f:facet>
                                <c_rt:choose>
                                    <c_rt:when test="#{wrapper.type==0}">
                                        <h:outputText value="#{wrapper.data}" styleClass="basic_thin"/>
                                    </c_rt:when>
                                    <c_rt:when test="#{wrapper.type==1}">
                                        <h:inputText value="#{wrapper.data}" styleClass="basic_thin" style="width:160px"/>
                                    </c_rt:when>
                                    <c_rt:when test="#{wrapper.type==2}">
                                        <h:outputLink value="#{wrapper.data}">
                                            <h:outputText value="#{msg.userorders_link}" styleClass="basic_thin"/>
                                        </h:outputLink>
                                    </c_rt:when>
                                </c_rt:choose>
                            </h:column>
                         </h:dataTable>trying to use jstl tags but unsuccessfull. Is it ever possible user jstl tags in jsf tags like listed above

    Replace the c:choose block by<h:outputText value="#{wrapper.data}" styleClass="basic_thin" rendered="#{wrapper.type == 0}" />
    <h:inputText value="#{wrapper.data}" styleClass="basic_thin" style="width:160px" rendered="#{wrapper.type == 1}" />
    <h:outputLink value="#{wrapper.data}" rendered="#{wrapper.type == 2}">
        <h:outputText value="#{msg.userorders_link}" styleClass="basic_thin"/>
    </h:outputLink>

  • How to use messagebar tag in jsp page

    i am working with "messagebar" control presents in the htmlb controls.
    my aim is to display the message after pressing some button. how to give link for that.
    if anybody have smple code for it please send me with component,jsp page and bean(if used)......
    ragards,
    ajoy

    Hi,
    If I understood you right, then you want to update the message shown in your messgebar, when user clicks on button.
    To achieve this, have a MessageBar with no message text. And when ever a button is clicked in the event handling method of your button set message text to your messagebar.
    public void showMessage(String message, MessageType type) {
            messageBar.setMessage(type, message);
    public void onClick(Event event) throws PageException {
          showMessage("Clicked Button", MessageType.INFO);
    Greetings,
    Praveen Gudapati
    [Points are always welcome for helpful answers]

  • How to use custome tag lib in the JSP page?

    How to use custome tag lib in the JSP page?...with JDeveloper

    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtTopicFile.working_with_jsp_pages%7Cjsp_ptagsregistering~html/

  • Way to remove HTML tags from a page-scoped attribute using JSTL?

    Hi,
    I'm using JSTL 1.2 with Tomcat 6.0.26. Does anyone know of a way to remove HTML tags from a page attribute, "${myExpr}". I would prefer a solution that uses JSTL only, but ultimately whatever gets the job done is fine with me.
    Thanks, - Dave

    I'm sorry, I don't understand your requirement. What do you mean by "remove HTML tags from a page attribute"?
    If you are dealing with a value of an attribute, it is most likely a String, and should be treated as such. The best approach would probably be java coding.

  • Help on oracle tags inside dynamic pages

    Hi All
    I have used dynamic pages like this , i create a html form inside a dynamic page on submit of which a procedure gets called & inserts the values in the table.
    I see some <oracle> tags every time i create a dynamic page but have never used them. Could some one tell how to use these tags. whether they can be used to call a procedure or can i embed any dml statements in these oracle tags.
    Kindly somebody could explain it with an example.
    Regards
    Sushant

    There is a brief description in the online help - see http://isd-demos2.oracle.com:7778/help/wvtdynam.htm.
    You can also search this forum - there have been many examples posted here.
    If you have further questions about dynamic pages, the Portal Applications forum would be a better place to post them.
    Regards,
    Jerry
    Portal PM

  • I want to display BLOB image in JSP Using  html tags IMG src=

    GoodAfternoon Sir/Madom
    I Have got the image from oracle database but want to display BLOB image using <IMG src="" > Html tags in JSP page . If it is possible than please give some ideas or
    Send me sample codes for display image.
    This code is ok and working no problem here Please send me code How to display using html tag from oracle in JSP page.
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="javax.swing.ImageIcon;" %>
          <%
            out.print("hiiiiiii") ;
                // declare a connection by using Connection interface
                Connection connection = null;
                /* Create string of connection url within specified format with machine
                   name, port number and database name. Here machine name id localhost
                   and database name is student. */
                String connectionURL = "jdbc:oracle:thin:@localhost:1521:orcl";
                /*declare a resultSet that works as a table resulted by execute a specified
                   sql query. */
                ResultSet rs = null;
                // Declare statement.
                PreparedStatement psmnt = null;
                  // declare InputStream object to store binary stream of given image.
                   InputStream sImage;
                try {
                    // Load JDBC driver "com.mysql.jdbc.Driver"
                    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
                        /* Create a connection by using getConnection() method that takes
                        parameters of string type connection url, user name and password to
                        connect to database. */
                    connection = DriverManager.getConnection(connectionURL, "scott", "root");
                        /* prepareStatement() is used for create statement object that is
                    used for sending sql statements to the specified database. */
                    psmnt = connection.prepareStatement("SELECT image FROM img WHERE id = ?");
                    psmnt.setString(1, "10");
                    rs = psmnt.executeQuery();
                    if(rs.next()) {
                          byte[] bytearray = new byte[1048576];
                          int size=0;
                          sImage = rs.getBinaryStream(1);
                        //response.reset();
                          response.setContentType("image/jpeg");
                          while((size=sImage.read(bytearray))!= -1 ){
                response.getOutputStream().write(bytearray,0,size);
                catch(Exception ex){
                        out.println("error :"+ex);
               finally {
                    // close all the connections.
                    rs.close();
                    psmnt.close();
                    connection.close();
         %>
         Thanks

    I have done exactly that in one of my applications.
    I have extracted the image from the database as a byte array, and displayed it using a servlet.
    Here is the method in the servlet which does the displaying:
    (since I'm writing one byte at a time, it's probably not terribly efficient but it works)
         private void sendImage(byte[] bytes, HttpServletRequest request, HttpServletResponse response) throws IOException {
              ServletOutputStream sout = response.getOutputStream();
              for(int n = 0; n < bytes.length; n++) {
                   sout.write(bytes[n]);
              sout.flush();
              sout.close();
         }Then in my JSP, I use this:
    <img src="/path-to-servlet/image.jpg"/>
    The name of the image to display is in the URL as well as the path to the servlet. The servlet will therefore need to extract the image name from the url and call the database.

  • How to use custom tag in jsp

    sir
    plz tell me how to use custom tag in jsp.plz describe it.
    i will be thankful to u

    Do you want to use taglibs or develop custom tags? Either way take a look at these:
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html
    http://www.stardeveloper.com/articles/display.html?article=2001081301&page=1
    http://www.onjava.com/pub/a/onjava/2000/12/15/jsp_custom_tags.html
    http://jakarta.apache.org/taglibs/tutorial.html
    http://www.ibm.com/developerworks/edu/j-dw-java-custom-i.html
    http://www.herongyang.com/jsp/tag.html

Maybe you are looking for

  • How do I unlock all files in site at once

    Have a site that someone else worked built. Most of my sites are GoLive, so easy to figure. All pages and files are locked. I am only one working on the site now. Sort of figured out how to unlock a file, but still confused by the page unlock process

  • G6-2277 5.1 sound system

    hi there. i have g6-2277 laptop. i want to know if my products supports 5.1 sound systems.  it has dolby feature on it and hdmi output but i want to have 5.1 on it.  if i buy one,and connect it to my laptop properly, will i be able to recieve 5.1 qua

  • Break out of Gateway branches

    I have a process that requires 10 people to review and approve a form before it can move on.  It does not need to be sequential and time is of the essence, so I have used a gateway and created 10 different branches.  The issue is that if any one of t

  • Convert date "yyyy-MM-dd" to "MM/dd/yyyy"

    Hi, First of all thank you for helping in advance. I am a new rookie in Java language. However, I have question regarding to converting the date format that I get from mysql to the regular US display date format. The question is I got the date from m

  • Single object referenced by static method

    Hi, I have a class, that I know in advance will only be instantiated ONE time. My problem is that I wish to address this object from elsewhere in the programme. I'm using: class Client{ private static Client me = new Client(); public static Client ge