Jstl taglib causes SAXParseException

I'm having a strange problem with Weblogic Server 7.0 and the JSTL taglib
          from Apache Jakarta. I've isolated the problem to the JSTL taglib
          declaration in my JSP. Whenever the taglib is included in a JSP, the page
          fails to load and displays "Error 500--Internal Server Error". An exception
          appears in the server log complaining that "The value of attribute "import"
          must begin with either a single or double quote character." However, the
          import attribute is correctly quoted. Experimentation showed that the JSP
          parser fails on the first attribute of any tag on the page whenever the JSTL
          taglib is included. Removing the taglib declaration makes the error
          disappear, and removing all tags but the taglib declaration also makes the
          problem disappear. The page runs fine on Tomcat. Any ideas what's wrong?
          Thanks,
          Dave
          Here's a minimal JSP that recreates the problem:
          [start page]
          <%@ page import="java.io.InputStream" %>
          <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
          [end page]
          Here's the exception stack trace from the console:
          <Oct 28, 2002 8:41:12 PM PST> <Error> <HTTP> <101019>
          <[ServletContext(id=4925452,name=cdshopcart,co
          ntext-path=/cdshopcart)] Servlet failed with IOException
          java.io.IOException: javax.servlet.jsp.JspException: The taglib validator
          rejected the page: "org.xm
          l.sax.SAXParseException: The value of attribute "import" must begin with
          either a single or double q
          uote character., "
          at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:124)
          at
          weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:255)
          at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:348)
          at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:206)
          at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:160)
          at
          weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:44
          7)
          at
          weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          :287)
          at
          weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          :376)
          at
          weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          :242)
          at
          weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
          ebAppServletC
          ontext.java:5360)
          at
          weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
          r.java:721)
          at
          weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
          ntext.java:30
          43)
          at
          weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
          :2468)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
          and here's a transcript of my web.xml file:
          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE web-app
          PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd">
          <web-app>
          <session-config>
          <session-timeout>
          30
          </session-timeout>
          </session-config>
          <welcome-file-list>
          <welcome-file>
          index.jsp
          </welcome-file>
          <welcome-file>
          index.html
          </welcome-file>
          <welcome-file>
          index.htm
          </welcome-file>
          </welcome-file-list>
          <taglib>
          <taglib-uri>"http://java.sun.com/jstl/core"</taglib-uri>
          <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
          </taglib>
          </web-app>
          

Ok, sorry, but this topic (including JSTL into logon page) has been already discussed.
So, does anyone know another solution how to include a page like masthead into the logon page?
Best Regards
Philipp Kölsch

Similar Messages

  • Jdev 10.1.2 problem define jstl tagLib

    hi,
    i have a problem in my jsp when i compile it with JDev 10.1.2, when trying to use JSTL tag:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    I always get the following message:
    Error(3,49): Attribute 'xmlns' used but not declared.
    Error(4,58): Attribute 'xmlns:xsi' used but not declared.
    Error(5,105): Attribute 'xsi:schemaLocation' used but not declared.
    Error(6,18): Attribute 'version' used but not declared.
    Error(33,19): Invalid element 'context-param' in content of 'web-app', expected elements '[resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.
    Error(34,18): Invalid element 'description' in content of 'context-param', expected elements '[param-name]'.
    but i saw this tutorial http://www.oracle.com/technology/products/jdev/tips/schalk/taglibs/taglibs.html
    and i check my preferences about my projet, i had the libraries standart.jar and jstl.jar to my project (Project Properties->Profile->developement->Libraries), and they are located in my <project>/public_html/WEB-INF/lib/
    And for the declaration of the taglib,
    Tools->Manage Libraries-> JSP TagLibraries the prefix "c" is defined, and it is the same uri what i'm using in my jsp.
    I make another with jdev 10.1.3, and i put my project, i compile and it work very fine.
    Thanks for any help.
    Regis.

    Hi this is my Web.xml
    I do not have a DTD with the web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <display-name>jGallery</display-name>
    <context-param>
         <param-name>useDataBase</param-name>
         <param-value>false</param-value>
    </context-param>
    <context-param>
         <param-name>dataSource</param-name>
         <param-value>java:comp/env/jdbc/jGallery</param-value>
    </context-param>
    <context-param>
         <param-name>thumbnailWriter</param-name>
         <param-value>de.jwi.jgallery.toolkit.ToolkitThumbnailWriter</param-value>
    </context-param>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/jGallery</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <context-param>
         <description>separate with commas</description>
         <param-name>dirmappings</param-name>
              <param-value>/=D:/temp/jg</param-value>
    </context-param>
    <servlet>
    <servlet-name>Controller</servlet-name>
    <servlet-class>de.jwi.jgallery.servlets.Controller</servlet-class>
         <init-param>
              <description>Path prefix, that maps to web ressources</description>
              <param-name>webprefix</param-name>
              <param-value>/web/</param-value>
         </init-param>
    </servlet>
    <servlet>
    <servlet-name>StatisticsController</servlet-name>
    <servlet-class>de.jwi.jgallery.servlets.StatisticsController</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Controller</servlet-name>
              <url-pattern>*.html</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>StatisticsController</servlet-name>
         <url-pattern>/Statistics/*</url-pattern>
    </servlet-mapping>
    <!--
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>jGallery</web-resource-name>
    <url-pattern>/Statistics</url-pattern>
    </web-resource-collection>
    <auth-constraint>
         <role-name>manager</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>Example Form-Based Authentication Area</realm-name>
    <form-login-config>
    <form-login-page>/security/login.jsp</form-login-page>
    <form-error-page>/security/error.jsp</form-error-page>
    </form-login-config>
    </login-config>
    <security-role>
    <role-name>manager</role-name>
    </security-role>
    -->
    <welcome-file-list>
         <welcome-file>jGallery.htm</welcome-file>
    </welcome-file-list>
    <jsp-config>
    <taglib>
    <taglib-uri> http://www.jwi.de/jGallery/taglib </taglib-uri>
    <taglib-location> /WEB-INF/jGallery.tld </taglib-location>
    </taglib>
    </jsp-config>
    </web-app>
    I'm not using the JSTL 1.1, in the "management libraries"
    i define a JSTL librarie and the version is 1.0.

  • JSF Trinidad, JSTL taglib

    Hi,
    Im trying to deploy a web application which uses trinidad ui components within jsp pages.
    It deploys ok, but whenever i hit a .jsf page (which is then taken and matched with the right jsp page), it gives the following error in the log about it not being able to parse the URI of "http://myfaces.apache.org/trinidad" and therefore the taglib was seemingly made invalid.
    I tried to get the .tld file from the jar and reference it in the web.xml, but it made no difference.
    Any ideas?
    Regards,
    Andrew

    I have had similar messages with taglibs - it was because the .tld files were DTD- based and CE 7.1 doesn't seem to like the older DTD definitions. Have a look and see if there is a newer version that uses an XML schema definition. I've had a look at JSF Trinidad and it appears v 1.0.6 has DTDs but 1.2.6 is Schema based.
    A lot of the issues we've been having are not to do with CE7.1 but the change from J2EE to JEE 5 e.g. using the Java Standard TagLibrary where the old jstl.jar and Standard.jar have been left in the the /lib directory.
    Hope this helps
    Ben
    Edited by: Ben Newton on Feb 13, 2008 1:55 PM

  • JSTL taglib declarations

    In new JSP 2.0 pages, I found there are two different types declarations:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    What's the difference between them? Thanks!

    <%@ taglib prefix="c" > uri="http://java.sun.com/jstl/core_rt" %>Supports JSP Scripting
    <%@ taglib prefix="c" > uri="http://java.sun.com/jsp/jstl/core" %>Supports Expression Language
    see http://java.sun.com/developer/technicalArticles/javaserverpages/faster

  • JSTL Function Causing JDev Designer to Hide Field

    I added a JSTL function to an OutputText field in an ADF Web application. The function itself works at run-time; however, in the JDev Designer, the Designer does not display the field.
    What I did was this:
    1. Added the namespace prefix to the page fragment:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    2. Added the function to an af:outputText. To keep this post simple, in the below example i just used 'MMM' as the fn:toLowerCase() param value:
    <af:panelLabelAndMessage label="#{viewcontrollerBundle.LOGGER_PROTOTYPE_2}" id="plam4"
    rendered="#{bindings.Type1.inputValue !=2 and bindings.MessageLevelId.inputValue != 0}">
    <af:outputText value="#{fn:toLowerCase('MMM')}" id="ot4"
    inlineStyle="font-family:'Courier New', Courier, monospace;"/>
    </af:panelLabelAndMessage>
    At runtime 'MMM' is correctly displayed as 'mmm'. However, the field is not visible in the JDev Designer - which will make this confusing to maintain. Is there something I am doing wrong, or am i missing a step?
    Versions: JDeveloper 11.1.1.6, Linux. JSTL functions library is for v. 1.2.
    Thanks for your help.

    There is no JDev version 11.1.1.6.0 (at least officially).
    Anyway, can you check what you see if you add some static text in front of the EL.
    I guess jdev tries to calculate the value, fails and you end up getting nothing (or in case of an outputText with no text which means nothing).
    Timo

  • Integrating Jakarta taglibs in Jdev 9.0.4 (other than JSTL)

    Hello --
    I'm having difficulty getting the magic spell for proper integration of Jakarta taglibs other than the JSTL taglibs to work.
    I've gone into Tools-&gt;Manage Libraries-&gt;Jsp Libraries and created a new Jsp library based on the .tld file / archive file / and uri, and assigned a prefix, but I can't use it.
    If I create a workspace from a WAR for something like 'application-examples.war' from the Jakarta site, when I try and compile the example page, I get a "Attribute 'xmlns:xalan' is used but not declared."
    and Jdev is unable to load the taghandler class.
    Has anyone had any luck getting these taglibs to integrate properly?
    Thanks,
    Donn

    Ok, now I'm going nuts. I can't get JSTL working either -- have tried with the &lt;taglib&gt; directive in web.xml, and without, have tried with registering the libraries in the JSP tab and not registering, and with the .tld files in the lib directory and not.
    Any successes out there?

  • JSTL X JSP fragment

    Hi there...
    I put a right JSTL code in a JSP fragment and it didn't work? What am I supposed to do to run a JSTL code in a JSP fragment. Is there any configuration in special?
    Thanks

    There is a fundamental difference between the include directive [url http://java.sun.com/products/jsp/syntax/1.2/syntaxref129.html#997991]<%@ include %>  and [url http://java.sun.com/products/jsp/syntax/1.2/syntaxref1214.html#8828] <jsp:include >
    The <%@ include %> tag includes the file at translation/compile time. It is like copying and pasting the contents of the "fragment" into the main JSP. It is then translated, compiled and run.
    The <jsp:include> tag includes the result of running that page at execution time. ie it is as if you made a web request to that URL, and pasted the response you got back into the response of the including page.
    What does this mean in your case?
    1 - a .jspf file will not be evaluated by <jsp:include>. If you make a request for the jspf file directly, it will send you the source, because it doesn't invoke the JSP servlet on jspf files.
    Solution: change the file to meujstl.jsp, and it should include ok.
    2 - The file needs to be standalone with regards to importing
    - tag libraries
    - packages (if any)
    etc etc.
    so you will need to import the core jstl taglib at the top of the page to use it with <jsp:include>
    Cheers,
    evnafets

  • Problem using jstl and displaytags

    Hi all,
    I am using display tags taglib for generation of table. One of the columns has to be shown with the hyperlink attached to it. In order to acheive this i am using jstl taglib together with displaytags
    <display:table name="reportList" id="row" requestURI="viewengagementstatus.do" style="width: 100%;">
    <display:column  title="Period"  sortable="true" style="text-align:  center;" >
    <a href="/jsps/reportsummary.do?eid=<c:out value="${row.eid}" />&reportId=<c:out value="${row.ReportID}" />&reportPeriod=<c:out value="${row.targetDate}"/> " target="_blank"><font size="1"><c:out value="${row.targetDate}"/></font></a>
    </display:column>I am using jstl1.1.2.jar for jstl.
    When i run this on Weblogic10 and windows OS i am able to view the results. On performing the view source on the IE window, i get the following:
    <td style="text-align:  center;">
                   <a href="/jsps/reportsummary.do?eid=78004&reportId=104093&reportPeriod=Nov-2008 " target="_blank"><font size="1">Nov-2008</font></a>
    </td>but when the same code is run on the Weblogic deployed on the Linux machine, i am not getting the links and the name:
    the view-source of the application deployed on the linux machine shows:
    td style="text-align:  center;">
                   <a href="/jsps/reportsummary.do?eid=&reportId=&reportPeriod=" target="_blank"><font size="1"></font></a>
    </td>Any Ideas why this is occuring?
    Any help would be appreciated

    You should be using the one or the other, not both. Since your actual code shows that you don't need the jstl/core_rt taglib (you're using the JSP EL ${ } in JSTL tags rather than scriptlets <%= %> ), just remove that taglib declaration and continue using the jstl/core taglib.
    You should also rather place both the JSTL and standard JAR in the classpath of the application server. In case of Tomcat, put it in its /lib directory. Then remove all unnecessary JSTL and Standard JAR and TLD files from your whole webapplication project and also remove any related entries from the web.xml of your webapplication project. To use JSTL you only need to put the JAR files in the classpath of the application server and define the taglib in your JSP. Nothing less and nothing more. If you're using JSTL 1.2 rather than JSTL 1.1, then you need to remove the standard.jar file too since it is already merged in the jstl-1.2.jar file.
    Oh, the web.xml should also be declared that way that the application server uses at least servlet 2.4.

  • User Library Taglibs Not Detected

    It seems that NitroX only detects jarred tag libraries if they are in the lib folder. I have, for instance, an Eclipse user library setup that includes the JSTL jar files. NitroX does not detect the JSTL taglibs, even though my deployed application works just fine. If, however, I copy the same jar files into the lib folder then suddenly NitroX detects them.
    Is this a bug?
    Thanks.

    Sorry about the incomplete information.
    We just released NitroX version 3.0 M1 (stable milestone build 463) which supports taglibs imported using "External JARs / Add Variable / Add (user) Library" method.
    Use any of this method(s) to include the external taglib jar file(s) and then follow below steps:
    - Close & reopen the project
    Note: By default tag libraries imported from external location do not list in the Tag Libraries view
    - The "Tag Libraries view" displays the respective tags that are defined using taglib definition
    Ex: <%@ taglib uri="http://jakarta.apache.org/taglibs/datetime" prefix="dt" %>

  • Portal JSTL support

    I was happy to see portal support the core JSTL taglibs since the apache implementation requires a JSP 1.2/Servlet 2.3 container but I was purplexed as to why only a subset of the the core tags are supported. Most noticably absent is the out tag, as well as the url and import tags. Is there any plans to support the full core tag set?
    TIA!

    I believe the JSTL 1.0.1 requires a servlets 2.3 and JSP 1.2 compliant container, which iws 6.0 isn't. I have learned that the portal server will be released in the near future on the appserver 7.0, at which time I will be able to use all the JSTL tags.
    Thanks!

  • How to use jstl in weblogic 8.1

    I tried to use JSTL in my jsp file and I add
              <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> at the top line. But the server reported
              java.lang.NoClassDefFoundError: javax/servlet/jsp/el/VariableResolver
              how to solve this problem?

    WebLogic 8.1 supports JSP 1.2, which doesn't natively implement the JSTL or the expression language. If you download the Jakarta Taglibs implementation of the JSTL (for JSP 1.2, not JSP 2.0), then you can use the JSTL taglib as a normal taglib. Note that this doesn't give you the ability to use the other JSP 2.0 tag features, like using the expression language in body content.
              Make sure that you use the uri value specified in the tld that you're using. I believe the values are different between the JSP 1.2 and JSP 2.0 versions.

  • No EL support in JSTL tags?

    I plan to use both JSTL and JSP 2.0 EL in my JSPs. I tried to use an if-tag, with an expression in the test attribute like this:
    <c:if test="${!empty sessionScope.userdata}"><h2><mywaf:include name="userinfo"/></h2></c:if>
    The JSTL specs show examples like this, i.e. using JSTL and EL together, which is a natural thing as JSTL actually introduced EL. So why does Tomcat give me an error when I access the page:
    org.apache.jasper.JasperException: /jsp/en_EN/template.jsp(14,0) According to TLD or attribute directive in tag file, attribute test does not accept any expressions
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:186)
    I looked into the JSTL core tag tld, and indeed, for every single attribute they specify
    <rtexprvalue>false</rtexprvalue>
    indicating that this is a "runtime attribute".
    So what am I doing wrong here?

    Okay, I found it:
    For reasons not totally obvious there are two versions of each JSTL taglib supplied, one "EL", one "RT":
    Excerpt from http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL4.html
    Twin Libraries
    The JSTL tag libraries come in two versions which differ only in the way they support the use of runtime expressions for attribute values.
    In the JSTL-RT tag library, expressions are specified in the page's scripting language. This is exactly how things currently work in current tag libraries.
    In the JSTL-EL tag library, expressions are specified in the JSTL expression language. An expression is a String literal in the syntax of the EL.
    When using the EL tag library you cannot pass a scripting language expression for the value of an attribute. This rule makes it possible to validate the syntax of an expression at translation time.
    Well, this confuses me... perhaps I have simply trouble understanding the words....
    RT allows me to use the "page's scripting language" (this has to be JSP EL, since there is no other (server sided) scripting language).
    EL specifies expressions in EL (which, what wonder, is EXACTLY the same as before?!)
    The last part explicitely says, that you cannot pass EL as parameter for JSTL tags using the EL version, but I still do not understand the fundamental difference between EL and RT. Why can't the syntax of an expression be evaluated at translation time when using RT? I mean, in both cases the expression is in the page and won't change anymore.
    <scratches head>
    I'm confused.

  • Are not interpreted JSTL tags in a JSP page including in a servlet.

    Hi people,
    I have a project where una page (index.jsp) includes a servlet (MyServlet), that consult a persistence class and get a List of objects (Users),      
    then the servlet passes the List to a Request object and includes another JSP page (showUsers.jsp). And this is conceptually correct, but don´t works, the JSTL tags are not interpreted in showUsers.jsp.
    This is my code...
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!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>Insert title here</title>
    </head>
    <body>
    <c:out value="Show me some things index.jsp"/>
    <div style="border-color:red; border:solid; padding-left:60px">
          <jsp:include flush="true" page="pepe/MyServlet"/>
    </div>
    </body>
    </html>...and the Servlet...
    public class MyServlet extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
              UserManager um = new UserManager();
              List users = um.getUsers(); //This use Hibernate to return a Users List
              request.setAttribute("users", (ArrayList) um.getUsers());
              request.getRequestDispatcher("/showUsers.jsp").forward(request, response);
    }...Finally, we have the showUsers.jsp file....
    <c:out value="Show me some thing showUsers.jsp"/>
    <table>
         <tr>
              <th>ID</th>
              <th>Name</th>
              <th>e-Mail</th>
              <th>Type</th>
         </tr>
         <tr>
              <c:foreach items="${requestScope.users}" var="user">
                   <td><c:out value="${user.id}" /></td>
                   <td><c:out value="${user.name}" /></td>
                   <td><c:out value="${user.email}" /></td>
                   <td><c:out value="${user.type}" /></td>
              </c:foreach>
         </tr>
    </table>This i get as result page...
    ID       Name       e-Mail       TypeFinally, this is the code of showUsers.jsp...
    <c:out value="Show me some thing showUsers.jsp"/>
    <table>
         <tr>
              <th>ID</th>
              <th>Name</th>
              <th>e-Mail</th>
              <th>Type</th>
         </tr>
         <tr>
              <c:foreach items="[src.User@18f729c, src.User@ad97f5, src.User@d38976, src.User@1e5c339, src.User@17414c8, src.User@7a17]" var="user">
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
              </c:foreach>
         </tr>
    </table>Somebody can help me?
    Many thanks,
    Gonzalo

    Thanks you all guys,
    I appreciate very much your help. In response to everyone ...
    BalusC wrote:
    Is JSTL taglib declared in top of that JSP page? I don't see it back in the posted code snippet. In this example I stuck...
    request.getRequestDispatcher("/showUsers.jsp").forward(request, response);By mistake, but this is just a test, the original line of my servlet is...
    request.getRequestDispatcher("/showUsers.jsp").include(request, response);As you can see, both (the servlet and the showUser.jsp file) are included in the index.jsp file. So the header...
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>...in the index.jsp file should works (I hope so).
    njb7ty wrote:
    I assume in your web.xml, you have ''pepe/MyServlet' defined as a servlet tag and servlet map tag? Without that, I don't think your JSP will find the servlet. I'm >not sure you need it in web.xml since I never call a servlet from a JSP page.
    I suggest putting System.out.println() throughout your servlet code and out.println() in your JSP pages to see exactly what is called and when.
    As a general rule, JSP files are to display data only, and submit back to a servlet. The servlet does all the business logic and dispatches to the appropriate >JSP page. The JSP shouldn't have any business logic. Including the servlet looks kinda like including business logic. Actually, in a MVC design, your >presentation, control, busines, and database layers have their own isolated responsibilities.
    I suggest the servlet put data as one java bean in request scope via request.setAttribute() and dispatch to the JSP page. The JSP page gets the data via ><useBean> tag. The JSTL gets the variables from the useBean tag and uses the data from there to display it. Really, this is my web.xml file...
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">
         <servlet>
              <servlet-name>MyServlet</servlet-name>
              <servlet-class>src.MyServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>MyServlet</servlet-name>
              <url-pattern>/pepe/MyServlet/*</url-pattern>
         </servlet-mapping>
    </web-app>Regarding putting System.out.println() and out.println(), i did it and thats works.
    Respect of your last comment, I am not a expert in MVC, but I understand that the view layer can make calls to the Controller layer, I am wrong?
    evnafets wrote:
    It's not. However thats not code, but the generated HTML.
    As Balusc pointed out it's the result of running this JSP page without importing the tag library at the top.
    Because the tag library is not declared, it treats the <c:forEach> and other tags as template text, and basically ignores them.
    It then evaluates the ${items} attribute as an expression in template text, calling toString() on it.
    Cheers,
    evnafets      The file showUsers.jsp are included into the index.jsp page, that's have the header taglib. Could this works?
    BalusC wrote:
    njb7ty wrote:
    By the way, I dont think this is the correct format for the foreach tag:
    <c:foreach items="[src.User@18f729c, src.User@ad97f5, src.User@d38976, src.User@1e5c339, src.User@17414c8, src.User@7a17]" var="user">You're right friend.
    And that's my problem. Any ideas?
    Thanks everyone,
    Gonzalo

  • Weird error with taglib

    Hello, I'm getting this weird error. Sometimes when I'm using taglibs I get org.apache.jasper.JasperException: /mypage.jsp(11,4) According to TLD or attribute directive in tag file, attribute value does not accept any expressions. I refresh the page, and it displays, refresh again and the error is there again, this keeps happening randomly.
    In this post I found a solution http://forum.java.sun.com/thread.jspa?threadID=683007&messageID=9423383, changing the taglib to the "_rt" works, but some guy says this is not a preferred solution.
    This is my code without the "fix":
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
    <!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=UTF-8">
            <title><fmt:message key="appTitle"/></title> 
        </head>
        <body>      
            <h3><fmt:message key="news"/></h3>
            <c:forEach items="${model.news}" var="news">
                <p>
                    <strong><c:out value="${news.title}"/></strong> - <i> <fmt:formatDate value="${news.daten}" pattern="dd/MM/yyyy"/> </i> - <a href="<c:url value="deleteNews.htm?newsId="/><c:out value="${news.id}"/>">Delete</a> - <a href="<c:url value="editNews.htm?newsId="/><c:out value="${news.id}"/>">Edit</a> <br>
                    <c:out value="${news.content}"/><br>
                    <small>Source:<c:out value="${news.source}"/></small>
                </p>
            </c:forEach>       
            <a href="<c:url value="addNews.htm"/>">Add News</a>       
        </body>
    </html>How can I fix this issue using the normal taglibs?
    Thanks in advance

    You seem to be mixing the versions of JSTL taglibs in your page.
    For the c taglib you are using the JSTL1.1 URI
    For the fmt taglib you are using the JSTL1.0 URI
    Change the import line to use the JSTL1.1 URI, and you should be set
    <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    (note the subtle change with /jsp in there)
    As I mentioned in the other post, use of the _rt taglib should be restricted to JSP1.2 containers (eg Tomcat4)
    In JSP2.0 containers (Tomcat5+) you should use JSTL1.1, and it should work perfectly, provided your web.xml file is up to date.
    Some other posts on the subject you might find useful, that explain why the JSTL1.0 tags did not accept runtime expressions:
    http://forum.java.sun.com/thread.jspa?threadID=628740
    http://forum.java.sun.com/thread.jspa?threadID=629437&tstart=0
    Cheers,
    evnafets (some guy)

  • JSTL isnt working

    Hello!
    I'm having problem with running jstl in eclipse
    I'm running
    eclipse 3.4.0
    tomcat 5.5
    spring 2.5.6
    I have put standard.jar and jstl.jar (from jakarta-taglibs-standard-1.1.2 ) in my:
    <webappliaction> -> <webContent> -> <WEB-INF> -> lib
    if i control my project properties -> Project Facets it's set to:
    "Dynamic Web Module" = 2.4
    "Java" =5.0
    "Java Server Faces" = 1.1
    my web.xml is set to:
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    when i access my jsp page which has jstl experssion lik ${myVariable} (is set in my controller and added to my model object)
    it prints ou ${myVariable} and not the value of "${myVariable}" ???
    I have googled but haven't found any solution to my problem and would be very glad if someone could help me solveing my problem,
    Thanks in advance!

    digital_storm wrote:
    when i access my jsp page which has jstl experssion lik ${myVariable} (is set in my controller and added to my model object)
    it prints ou ${myVariable} and not the value of "${myVariable}" ???That's not JSTL. That's EL. EL in template text, to be precise.
    It should just work, regardless of having JSTL installed or not. It's part of JSP 2.0 (Servlet 2.4).
    Don't you have an el-ignored JSP setting in web.xml? Or an isElIgnored page directive in top of your JSP? Don't you have duplicated (or missing) EL JAR files (el.jar, jsp-el.jar and so on) in your classpath? It should by default already be available in Tomcat, if you left its libraries untouched.
    Apart from that, to test if JSTL works, you need to declare the JSTL taglib and use one of the JSTL tags like c:out and so on.

Maybe you are looking for

  • Display only/Grey out Delivery Schedule tab in the PO

    We are not going to use Delivery Schedule tab at all. Business wants us to Grey out the delivery schedule tab. Is it possible to make all fields under Delivery Schedule as display only? If yes, how can I do that? But, I don't want PO line qty to be g

  • HT201364 Free up memory space on start up disk

    How do you remove items from start up disk to free memory space?

  • Is there an solution for the wi-fi internet connectivity using a MBP?

    I have frustration while trying to stay connected to the internet. I bought this MacBook Pro thinking the technology was far superior to other notebooks. Now I have realized the wireless connectivity issue is something tech support has been unable to

  • Fuctional Specification for Incoming HSBC fIle

    Hello Every one, I have one l Requirement for me , When we make payment to vendor through F110 ,after that we run one program we got out going file to HSBC bank it was completed it runs succes fully it generate the out going file ,now my requirement

  • Re: Validation Against A Schema With DOM

    I tried to redeploy a properly working application using Schema not DTD. It worked perfectly before but after redeployment, I got this an error complaining of missing "AbstractDOMParser". I downloaded this jar "xercesImpl.jar" which contain "Abstract