facebook

Errors in JSP using JSF [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #214682 Reply

    joegaber
    Member

    I created a new J2EE web app project. I added JSF support from MyEclipse menu. I created a new JSF JSP page. I did not add anything to the default page. I ran the build routine. Below is the JSP page content. I get 2 errors during the build:

    1. package com.sun.faces.taglib.jsf_core does not exist: com.sun.faces.taglib.jsf_core.ViewTag _jspx_th_f_view_0 = (com.sun.faces.taglib.jsf_core.ViewTag) _jspx_tagPool_f_view.get(com.sun.faces.taglib.jsf_core.ViewTag.class);

    2. package com.sun.faces.taglib.jsf_core does not exist: com.sun.faces.taglib.jsf_core.LoadBundleTag _jspx_th_f_loadBundle_0 = (com.sun.faces.taglib.jsf_core.LoadBundleTag) _jspx_tagPool_f_loadBundle_var_basename_nobody.get(com.sun.faces.taglib.jsf_core.LoadBundleTag.class);

    <%@ page language=”java” %>
    <%@ taglib uri=”http://java.sun.com/jsf/html&#8221; prefix=”h” %>
    <%@ taglib prefix=”f” uri=”http://java.sun.com/jsf/core&#8221; %>

    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <base href=”<%=basePath%>”>

    <title>My JSF ‘MyJsp.jsp’ starting page</title>

    <meta http-equiv=”pragma” content=”no-cache”>
    <meta http-equiv=”cache-control” content=”no-cache”>
    <meta http-equiv=”expires” content=”0″>
    <meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
    <meta http-equiv=”description” content=”This is my page”>
    <!–
    <link rel=”stylesheet” type=”text/css” href=”styles.css”>
    –>
    </head>

    <body>
    <f:view>
    <f:loadBundle basename=”BUNDLE_NAME_HERE” var=”bundle”/>
    This is my JSF JSP page. <br>
    </f:view>

    </body>
    </html>

    #214689 Reply

    Riyad Kalla
    Member

    Joe,
    What JAR files do you have on your project’s Build Path?

    #214701 Reply

    joegaber
    Member

    In project directory:

    J2EE 1.4 Library Container
    JRE System Library [j2re 1.4.1]
    dom.jar
    jaxen-full.jar
    jaxp-api.jar
    jdbc2_0-stdext.jar
    jstl.jar
    mail.jar
    sax.jar
    saxpath.jar
    standard.jar
    xalan.jar
    xercesImpl.jar

    in WebRoot directory:
    MyJsp.jsp
    /WEB-INF/lib/commons-beanutils.jar
    /WEB-INF/lib/commons-collections.jar
    /WEB-INF/lib/commons-digester.jar
    /WEB-INF/lib/commons-logging.jar
    /WEB-INF/lib/jsf-api.jar
    /WEB-INF/lib/jsf-impl.jar

    /WEB-INF/c-rt.tld
    /WEB-INF/c.tld
    /WEB-INF/faces-config.xml
    /WEB-INF/fmt-rt.tld
    /WEB-INF/html-basic.tld
    /WEB-INF/jsf_core.tld
    /WEB-INF/sql-rt.tld
    /WEB-INF/web.xml
    /WEB-INF/x-rt.tld
    /WEB-INF/x.tld

    #214702 Reply

    Riyad Kalla
    Member

    You need to add the remaining JARs that provide the JSF implementation to your build path… while they are in your lib directory (which is good for running them) it doesn’t allow Eclipse to resolve the classes at compile time (in this case JSP validation time).

    MyEclipse has a setting that defaults to “true” where it will automatically add any JARs in WEB-INF/lib to your build path, so it might be turned off or maybe you manually removed these JAR files from your build path?

    #214703 Reply

    joegaber
    Member

    Can you walk me through the steps to do this to make sure I understand? Thanks

    #214705 Reply

    Riyad Kalla
    Member

    Sure,
    To add/remove JAR files from your project’s build path you would do the following:

    1) Right click on your project root node
    2) Select “Properties” at th bottom.
    3) Click in the left pane “Java Build Path”
    4) Click in the right pane the “Java Libraries” tab
    5) Here you have a few choices:

      a) Click “Add JARs” to add a JAR from your project ONLY (this is what you want to do)
      b) Click “Add External JARs” to add a reference to a JAR that is anywhere on your computer
      c) Click “Add Library” to add a reference to a User Library or a J2EE Library Set that MyEclipse ships with.
      e) the other two buttons you can use if necessary, I don’t use them though.

    In our case we want to click “Add JARs” then navigate to our WEB-INF/lib directory, and add all the JAR files listed. NOTE: Eclipse will only show you JAR files that HAVE NOT already been added to your Build Path, so you don’t need to worry about adding duplicates.

    Once you’ve added these libraries to your build path, go ahead and go up to the Projects menu and select “Clean”, select your project, then hit OK and Eclipse should clean and rebuild your project for you (including the JSP pages).

    If you were asking about how to turn that auotmatic feature back on, it is located at: Window > Preferences > MyEclipse > J2EE Project > Web Project Deployment > “Web Project Build Path Policy”, select the first option. Now whenever JARs are added to your WEB-INF/lib dir, they will automatically be added to your build path for you.

    #214706 Reply

    joegaber
    Member

    This was the most outstanding tech support I think I’ve ever had. The turn around was unbelievable, and the simple, yet detailed explaination was so good I can hardly believe it. Thank you very very much!!!!!

    #214707 Reply

    Riyad Kalla
    Member

    Wow, thanks Joe we really appreciate the comments. I’m going to send this to the team, its a great pick-me-up for everyone.

    Let us know if you have any other questions.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Errors in JSP using JSF [Closed]

You must be logged in to post in the forum log in