HTML Target Tags in JSF...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    HTML Target Tags in JSF...

    Hey Gang!

    I thought I had a good idea but then I realized JSF doesn't play that...

    I am trying to mimick what HTML can do in JSF when using target tags to related to inner HTML pages. In orther to get to a links going smoothly in JSF, on would do:

    [CODE=JSF]

    <%@ page contentType="te xt/html" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

    <f:view>
    <html>
    <head><title>js f h:commandLink example</title></head>

    <body>
    <h:form>
    <h:commandLin k value="Click here for Homepage"
    action="HomePag e" />
    </h:form>
    </body>
    </html>
    </f:view>

    [/CODE]

    This works great with the body of your JSF enabled JSP page. But in the case you need to use marginal links to fire such pages, as in frames from HTML pages, one would do:

    Index.html

    [CODE=HTML]

    <html>
    <head>

    <title>Just Music </title>

    </head>


    <!--Company logo-->
    <frameset rows=" 90,*">
    <frame noresize="nores ize" src="rhlg.html" scrolling="no">
    <!--Company link-->
    <frameset cols=" 200,*">
    <frame noresize="nores ize" src="link.html" scrolling="scro lling">
    <!--Company body-->
    <frame noresize="nores ize" src="default.ht ml" name="colours" marginheight="0 " marginwidth="10 ">
    </frameset>
    </frameset>
    </html>


    link.HTML

    The link page in turn would have something like this:

    [CODE=HTML]

    <body bgcolor="#CCCCC C" onload="RotateI t()">

    ....

    <table align="center" border="0" cellspacing="0" cellpadding="2" rules="cols" width="70" height="20" bgcolor="gray">
    <tr bgcolor="red">
    <td bgcolor="#D3D3D 3" colspan="2"><br >
    <center><font size="-1">
    <a href="default.h tml" target="colours ">Dököll Home</a><br>
    <a href="sched103. html" target="colours ">Schedule</a>
    <br>
    <a href="MediaPlay list.html" target="colours ">Media Playlist</a>
    <br>
    <a href="Usolutes. html" target="colours ">Company info</a>
    <br>
    <a href="UAccessor .html" target="colours ">Dj Accessories</a>
    <br>
    <a href="Upinskeys .html" target="colours ">Pins & Keys</a>
    <br>
    <a href="UPhanthom DjListBox.html" target="colours ">Goods/Services</a>
    <br>
    <a href="UEmail.ht ml" target="colours ">Send Email</a></center>

    </font> </p><center>

    [/CODE]
    ....


    The default page would be the HomePage...

    On e links are accessed through link.HTML, the inner HTML frame would display HomePage.HTML.

    Th problem is getting JSF to mimick this effortlessly, what I get is an additional window when you using:

    [CODE=JSF]
    <f:view>
    <html>
    <head><title>js f h:commandLink example</title></head>

    <body>
    <h:form>
    <h:commandLin k value="Click here for Homepage"
    action="HomePag e" />
    </h:form>
    </body>
    </html>
    </f:view>

    [/CODE]

    I cannot find a translation to from target="colours " in HTML to JSF.

    Any input you have is appreciated.

    Happy Sunday!

    Dököll
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    I am getting warmer, get a look at the resemblance, quite fetching isn't it?

    Comment

    • Dököll
      Recognized Expert Top Contributor
      • Nov 2006
      • 2379

      #3
      Getting there, a bit stuck. The link in the navigation area is not working properly. Seems stuck:
      link.jsp
      [CODE=JAVA]
      <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
      <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
      <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>Navigati onal Links</title>
      </head>
      <body>
      <f:view>
      <h:form>
      <h:commandLin k value="Click here for Homepage"
      action="retriev e_success" />
      </h:form>
      </f:view>
      </body>
      </html>

      [/CODE]

      we need a header, I did not add any text yet, just generated code. But the link above does not seem to work, I will also post the errors much after:

      header.jsp
      [CODE=JAVA]
      <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
      <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
      <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>Header File</title>
      </head>
      <body>
      <f:view>

      </f:view>
      </body>
      </html>

      [/CODE]

      again, it's nothing fancy, just generated code, then retrieve_page.j sp as the body of the new page, which in the case is a log in page:

      retrieve_page.j sp
      [CODE=JAVA]
      <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
      <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
      <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>Log In Form</title>
      </head>
      <body>
      <f:view>
      <h:form>
      <table>
      <tr>
      <td><h:outputTe xt value
      ="Enter Login ID: " /></td>
      <td><h:inputTex t id=
      "UserID" value="#{Retrie veBean.UserID}" /></td>
      </tr>
      <tr>
      <td><h:outputTe xt value=
      "Enter Password: " /></td>
      <td><h:inputSec ret id=
      "UserPswrd" value="#{Retrie veBean.UserPswr d}" ></h:inputSecret></td>
      </tr>
      <tr>
      <td>&nbsp;</td>
      <td><h:commandB utton value=
      "Enter here" action="#{Retri eveBean.GetVali dLoginData}" /></td>
      </tr>
      </table>
      </h:form>

      </f:view>
      </body>
      </html>

      [/CODE]

      here is what makes it all work, just like html but with some tweecking, it looks like I'll have what I need. But I need your help, I think I am too burned out;-(

      [CODE=JAVA]

      <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
      <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
      <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>ReloadPa ge</title>
      </head>
      <f:view>
      <frameset rows="46,*" frameborder="ye s" framespacing="0 " border="2">
      <frame src=" header.jsf" name="header" scrolling="no" noresize="nores ize"/>
      <frameset cols="20%,80%" border="2" frameborder="no " framespacing="2 " >
      <frame src="navtree.js f" name="navigatio n" scrolling="yes" frameborder="no " noresize="nores ize"/>
      <frameset rows="90%,22" frameborder="no " framespacing="0 ">
      <frame src="retrieve_p age.jsf" name="navigatio n" frameborder="no " scrolling="yes" frameborder="no " noresize="nores ize"/>
      </frameset>
      </frameset>
      </frameset>
      </f:view>
      </html>

      [/CODE]


      All work well except the link part, the first bit of code {"action="retri eve_success} seems simple but I just can't quite put my finger on it:

      Here are some of the errors, they don't seems to be English:-)

      [CODE=JAVA]

      Nov 18, 2008 1:36:14 AM com.sun.faces.a pplication.Navi gationHandlerIm pl getViewId
      WARNING: "JSF1013: Unable to find matching navigation case from view ID '/link.jsp' for outcome 'retrieve_succe ss' and action 'retrieve_succe ss'

      [/CODE]

      Any guidance you have is greatly appreciated...

      actually, this "for outcome 'retrieve_succe ss' and action 'retrieve_succe ss'" is telling me something, seems a little funky sounding:-)

      Thanks again!
      Last edited by Dököll; Nov 18 '08, 06:59 AM. Reason: clarity...

      Comment

      • Dököll
        Recognized Expert Top Contributor
        • Nov 2006
        • 2379

        #4
        Originally posted by Dököll
        Getting there, a bit stuck. The link in the navigation area is not working properly. Seems stuck:
        link.jsp
        [CODE=JAVA]
        <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
        <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
        <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Navigati onal Links</title>
        </head>
        <body>
        <f:view>
        <h:form>
        <h:commandLin k value="Click here for Homepage"
        action="retriev e_success" />
        </h:form>
        </f:view>
        </body>
        </html>

        [/CODE]

        we need a header, I did not add any text yet, just generated code. But the link above does not seem to work, I will also post the errors much after:

        header.jsp
        [CODE=JAVA]
        <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
        <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
        <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Header File</title>
        </head>
        <body>
        <f:view>

        </f:view>
        </body>
        </html>

        [/CODE]

        again, it's nothing fancy, just generated code, then retrieve_page.j sp as the body of the new page, which in the case is a log in page:

        retrieve_page.j sp
        [CODE=JAVA]
        <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
        <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
        <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Log In Form</title>
        </head>
        <body>
        <f:view>
        <h:form>
        <table>
        <tr>
        <td><h:outputTe xt value
        ="Enter Login ID: " /></td>
        <td><h:inputTex t id=
        "UserID" value="#{Retrie veBean.UserID}" /></td>
        </tr>
        <tr>
        <td><h:outputTe xt value=
        "Enter Password: " /></td>
        <td><h:inputSec ret id=
        "UserPswrd" value="#{Retrie veBean.UserPswr d}" ></h:inputSecret></td>
        </tr>
        <tr>
        <td>&nbsp;</td>
        <td><h:commandB utton value=
        "Enter here" action="#{Retri eveBean.GetVali dLoginData}" /></td>
        </tr>
        </table>
        </h:form>

        </f:view>
        </body>
        </html>

        [/CODE]

        here is what makes it all work, just like html but with some tweecking, it looks like I'll have what I need. But I need your help, I think I am too burned out;-(


        index.jsp
        [CODE=JAVA]

        <%@ page language="java" contentType="te xt/html; charset=ISO-8859-1" pageEncoding="I SO-8859-1"%>
        <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
        <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>ReloadPa ge</title>
        </head>
        <f:view>
        <frameset rows="46,*" frameborder="ye s" framespacing="0 " border="2">
        <frame src=" header.jsf" name="header" scrolling="no" noresize="nores ize"/>
        <frameset cols="20%,80%" border="2" frameborder="no " framespacing="2 " >
        <frame src="link.jsf" name="navigatio n" scrolling="yes" frameborder="no " noresize="nores ize"/>
        <frameset rows="90%,22" frameborder="no " framespacing="0 ">
        <frame src="retrieve_p age.jsf" name="navigatio n" frameborder="no " scrolling="yes" frameborder="no " noresize="nores ize"/>
        </frameset>
        </frameset>
        </frameset>
        </f:view>
        </html>

        [/CODE]


        All work well except the link part, the first bit of code {"action="retri eve_success} seems simple but I just can't quite put my finger on it:

        Here are some of the errors, they don't seems to be English:-)

        [CODE=JAVA]

        Nov 18, 2008 1:36:14 AM com.sun.faces.a pplication.Navi gationHandlerIm pl getViewId
        WARNING: "JSF1013: Unable to find matching navigation case from view ID '/link.jsp' for outcome 'retrieve_succe ss' and action 'retrieve_succe ss'

        [/CODE]

        Any guidance you have is greatly appreciated...

        actually, this "for outcome 'retrieve_succe ss' and action 'retrieve_succe ss'" is telling me something, seems a little funky sounding:-)

        Thanks again!
        Bingo Folks, Bing-Freaking-Go!

        Told you I was tired, here's the scoop, I forgot to also name it colours, while calling olours:

        [CODE=JAVA]

        <f:view>
        <frameset rows="46,*" frameborder="ye s" framespacing="0 " border="2">
        <frame src=" header.jsf" scrolling="no" noresize="nores ize"/>
        <frameset cols="20%,80%" border="2" frameborder="no " framespacing="2 " >
        <frame src="link.jsf" scrolling="yes" frameborder="no " noresize="nores ize"/>
        <frameset rows="90%,22" frameborder="no " framespacing="0 ">
        <frame src="retrieve_p age.jsf" name="colours" frameborder="no " scrolling="yes" frameborder="no " noresize="nores ize"/>
        </frameset>
        </frameset>
        </frameset>
        </f:view>
        [/CODE]

        That's it, that's all it was...

        No errors... Unbelievable. Well, it's here now, others won't ahve to go through the turmoil:-)

        In a bit!

        Comment

        • Dököll
          Recognized Expert Top Contributor
          • Nov 2006
          • 2379

          #5
          I must caution, a JSF tutorial is so needed before diving in to web apps, looking at my problem above, one would not know how to go through it an get it to work. Especially with my poor explaination of the problem.

          Here's a reference on JSF: JavaServer Faces (JSF) Tutorial Net.

          Comment

          Working...