JSTL help

Hey hey!!! ;)
Listen, I'm trying to create a JSP page that uses JSTL tags to check user inputs (in i.e Username and Password fields )against existing rows in a database.
At the moment, the page that is supposed to do the checking generates this message after 'ant install':
According to TLD or attribute directive in tag file, attribute value does not accept any expressions
Been trying to find my own way out, but think I'm going around in circles...
Thanks heaps :))))))) to whoever can point me in the right direction.
Cheers.
CluedOut.

Hey!
Thought I might repost, I'm getting nowhere myself and therefore would appreciate some help.
Here's the problem, I'm trying to create a JSP page that uses JSTL tags to check user inputs (in i.e Username and Password fields )against existing rows in a database.
Here's what I' ve come up with for it:
<!-- Continue.jsp -->
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Continue</title>
</head>
<body>
<sql:setDataSource
url="jdbc:odbc:library"
driver="sun.jdbc.odbc.JdbcOdbcDriver" />
<sql:query var="logIn">
SELECT * FROM Patrons, Staff WHERE Email = ?
<sql:param value = "${Username}"/>
AND PassWd = ?
<sql:param value = "${Password}"/>
</sql:query>
<c:forEach items="${logIn.rows}" var="row">
<!--c:out value="${row.product_name}"/-->
</c:forEach>
          <c:if test="${logIn.rowCount == 0}"><c:redirect url="error.jsp"></c:redirect></c:if>
          <c:if test="${logIn.Passwd != u}"><c:redirect url="error.jsp"></c:redirect></c:if>
<sql:query var="patronStaff">
SELECT * FROM Patrons WHERE Email = ?
<sql:param value = "${Username}"/>
</sql:query>
<c:forEach items="${patronStaff.rows}" var="check">
<!--c:out value="${row.product_name}"/-->
</c:forEach>
<c:if "${patronStaff.rowCount == 1}"><c:redirect url="patronHome.jsp"></c:redirect></c:if>
<c:otherise><c:redirect url="staffHome.jsp"></c:redirect></c:otherise>
<br>
</body>
</html>
After I 'ant install', the headline screams: org.apache.jasper.JasperException: /Continue.jsp(44,7) Unterminated <c:if tag
Dumbfounded, in need of assistance, thanks heaps to whoever can help.
Cheers.
cluedOut.

Similar Messages

  • Frustrating JSTL, help me plz

    I'm using Tomcat 5 and JSTL 1.1. I copied the JSTL files jstl.jar and standard.jar in Tomcat's /root/WEB-INF folder. Then I ran the following code
    <%@ page contentType="text/html" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <body bgcolor=lightblue>
    <form   method=post  action="demo1.jsp">
    NAME <input  type=text  name="text1"><br>
    PLACE<input  type=text  name="text2"><br>
           <input type=submit>
    </form>
    NAME:<c:out value="${param.text1}"  /><br>
    PLACE:<c:out value="${param.text2}"  />
    </body>
    </html>After clicking submit, the code failed to get the value. What's wrong in it? Do I need to copy those tld's in WEB_INF or do I need to make certain change in my web.xml file? I'm working hard since yesterday, help me plz.

    You are still using the JSTL1.0 uri
    The taglib import should be:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    (note the subtle addition of /jsp/ in there)
    See this thread for full details on setting up JSTL and Tomcat:
    http://forum.java.sun.com/thread.jspa?threadID=629437&tstart=0 rely #6

  • JavaScript, JSTL help. Anyone please.

    Hi All,
    I got a Page1.jsp and corresponding Page1.java. Their is a button on the Page1.jsp. On the onclick event i write a javascript which have to call a method in my Page1.java. How can i get about doing it. Am using JSTL also in the jsp page. If that might be of any help.
    Help will be appreciated.
    Thanks.
    Vivek.

    Thanks for the prompt reply. Will look in to the links. Meanwhile what i wanna do is that i wanna open another window in the onclick window using the window.open() and at the same time invoke a method in the bean for executing some business logic required to render the new page that will open from window.open().
    If i do the code invoking the business logic in the action method the form gets submitted this is what i dont want. And also the action is done after the window.open() executes so for the first time the window is blank. So what i plan is to call the bussiness logic method first and then open another window. by window.open().
    Hope this is helpful.

  • Help needed on Servlets and JSTL

    Hi
    I am using tomcat 5.5 and JDK 1.5. What are the softwares I have to download for compiling servlets and creating JSTL ?. Help needed.
    Thanks
    IndyaRaja

    I tried compling servlet, but it is raising error
    that coul not find package javax.servletWhat I did not mention... you need to add those JARs in the Classpath explicitly. You will find them in %TOMCAT_HOME%\common\lib. You atleast need to add servlet-api.jar to your Classpath. :)

  • Help needed to run JSTL 1.1 in Tomcat 6.0.16

    Hi All,Help needed to run JSTL 1.1 in Tomcat 6.0.16. I am trying to run the example given in http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html The example tries to connect to MySQL database from JSP using JSTL and JNDI Datasource.I am running the example using Eclipse 3.4.2 using Sysdeo plugin to start and stop Tomcat server from Eclipse IDE.
    My web.xml file has <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    </web-app>
    and test.jsp has proper taglib directives
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    I have placed the jstl.jar and standard.jarof the jakarta-taglibs-standard-1.1.2.zip under E:\Deepa\workspace\DBTest\WebContent\WEB-INF\lib directory also placedcontext.xml file under E:\Deepa\workspace\DBTest\WebContent\META-INF and the content of context.xml is as below
    <Context path="/DBTest" docBase="DBTest"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
    maxActive="100" maxIdle="30" maxWait="10000"
    username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
    </Context>
    Now while running the example, Eclipse creates one DBTest.xml file under C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
    which has the following line:
    <Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest" workDir="E:\Deepa\workspace\DBTest\work" />
    I am getting the following error when running http://localhost/DBTest/WebContent/test.jsp
    in Browser:
    <HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    In the Tomcat Server console, I am getting the following error:
    INFO: Server startup in 7295 ms
    May 20, 2009 6:36:48 AM org.apache.jasper.compiler.TldLocationsCache processWebDotXml
    WARNING: Internal Error: File /WEB-INF/web.xml not found
    May 20, 2009 6:36:48 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    what is the problem with my code?
    When running the same example, by creating a local server in Eclipse(creating new Server connection pointing to same Tomcat 6.0 installation) it runs fine without any error.

    Hi evnafets,
    Wow, very helpful information, great insight into working of Eclipse. Thanks a lot.
    I have one more question. I have a context.xml file under {color:#0000ff}E:\Deepa\workspace\DBTest\WebContent\META-INF{color} folder and that has the Resource element to connect to MySQL database:
    {code{color:#000000}}{color}<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    {color:#0000ff}url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>{color}
    {color:#0000ff}</Context>{color}As usual when running application in local Tomcat server of Eclipse, this data source works fine. But when I run the application on Tomcat, by starting Sysdeo plugin from Eclipse, the DBTest.xml file created in C:\Tomcat 6.0\conf\Catalina\localhost has the context entry as<Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest\WebContent" workDir="E:\Deepa\workspace\DBTest\work">
    </Context>The<Resource> element I have specified in the context.xml of \WebContent\META-INF folder is not taken into account by Tomcat and it gives the following error:May 21, 2009 5:20:04 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException_: Cannot create JDBC driver of class '' for connect URL 'null'"
    _at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(_QueryTagSupport.java:276_)
    at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(_QueryTagSupport.java:159_)
    at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(_test_jsp.java:113_)
    at org.apache.jsp.test_jsp._jspService(_test_jsp.java:66_)
    at org.apache.jasper.runtime.HttpJspBase.service(_HttpJspBase.java:70_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.jasper.servlet.JspServletWrapper.service(_JspServletWrapper.java:374_)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(_JspServlet.java:342_)
    at org.apache.jasper.servlet.JspServlet.service(_JspServlet.java:267_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:290_)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:206_)
    at org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:233_)
    at org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:191_)
    at org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:128_)
    at org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:102_)
    at org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:109_)
    at org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:286_)
    at org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:845_)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(_Http11Protocol.java:583_)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(_JIoEndpoint.java:447_)
    at java.lang.Thread.run(_Thread.java:619_)
    {code}
    So to overcome this error I had to place the <Resource> element in DBTest.xml under C:\Tomcat 6.0\conf\Catalina\localhost {color:#000000}and then it works fine. {color}{color:#ff0000}*Why is the context.xml file in META-INF not considered by Tomcat server using Sysdeo Plugin?*
    *Thanks,*
    *Deepa*{color}
    {color}
    Edited by: Deepa76 on May 26, 2009 9:32 PM

  • JSTL c:out and PageContext: need help!!!!!!!!!!!!!

    hi, i'm finding problems using core tag libraries, and i can't understand how to solve but expecially WHY i'm getting all those compilation errors....
    first, i post my jsp's scriptlets section for evaluating errors, but please, firstly go to the end of scriptlet's section to understand what i'm asking.
    ################# JSP'S SCRIPTLETS SECTION ##############
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page session="true"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <%@page import="services.sessionservice.*"%>
    <%@page import="util.*"%>
    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <jsp:useBean id="loginManagement" class="bflows.LoginManagement" scope="session"/>
    <jsp:setProperty name="loginManagement" property="nickName" param="nickName"/>
    <jsp:setProperty name="loginManagement" property="password" param="password"/>
    <jsp:setProperty name="loginManagement" property="loggedOn" value="false"/>
    <%
        Cookie[] cookies = request.getCookies();
        String message = null;
        // SETTO UN ATTRIBUTO CON SCOPE PAGE PER L'UTILIZZO CON LE TAGLIBS PER L'OUTPUT IN XML
        // LO UTILIZZO COME SE FOSSE UNA VARIABILE PER POI EFFETTUARE IL GIUSTO OUTPUT.
        // ######################## ENGLISH FOR JAVA.SUN FORUM #####################
        // "OUTPUT" AND "MESSAGE" ARE ATTRIBUTES SETTED TO CHOOSE WHICH XML NODE I WANT TO SELECT
        // FOR OUPUT.
        pageContext.setAttribute("output","login");
        pageContext.setAttribute("message",null);
        String output = "login";
        String action = request.getParameter("action");
        // Controllo che (1� if) esista il cookie NICKNAME e che contenga dei valori; poi controllo che (2� if)
        // I valori contenuti corrispondano a quelli della sessione corrente.
        if(cookies != null) {
            if(Session.getValue(cookies,"NICKNAME",0) != null && Session.getValue(cookies,"NICKNAME",1) != null){
                if(Session.getValue(cookies,"NICKNAME",0).equals(loginManagement.getNickName())
                && Session.getValue(cookies,"NICKNAME",1).equals(loginManagement.getSessionID())) {
                    loginManagement.setLoggedOn(true);
        if(action != null){
            if(action.equals("login")){
                loginManagement.logon();
                if(loginManagement.getCookies() != null){
                    for(int i=0;i<loginManagement.getCookies().length;i++){
                        response.addCookie(loginManagement.getCookies(i));
                        cookies=loginManagement.getCookies();                   
                    loginManagement.setLoggedOn(true);
            if(action.equals("logout")){
                loginManagement.setCookies(cookies);
                loginManagement.logout();
                // Rispedisce i cookie al client con MaxAge = 0, cos� questi verranno cancellati.
                for(int i=0;i<loginManagement.getCookies().length;i++){
                    response.addCookie(loginManagement.getCookies(i));
                loginManagement.setLoggedOn(false);
        if(loginManagement.getLoggedOn()){
            // MOSTRA IL MESSAGGIO DI BENVENUTO (SHOWS THE WELCOME MESSAGE)
            pageContext.setAttribute("output","welcome");
            output = "welcome";
        else {
            if(action != null && action.equals("logout")){
                // TORNA ALL'INIZIO (SHOWS THE LOGIN FORM)
                pageContext.setAttribute("output","login");
                output = "login";
            else {
                if(loginManagement.getResult() == -1){
                    throw new Exception("Errore nell'applicazione: consultare i log");       
                if(loginManagement.getResult() == -2){
                    // STAMPA IL MESSAGGIO DI ERRORE (PRINTS THE ERROR MESSAGE)
                    pageContext.setAttribute("message",loginManagement.getErrorCode());
    %>############# END OF SCRIPTLETS' SECTION ###########
    now i'll paste 2 short taglibs sections which will be appended after the code i pasted above: the first working, the second not compiling:
    ################## FIRST TAGLIB SECTION #############
    <c:set var="xmlDocument" scope="page">
        <ROOT>
        <%if(output.equals("welcome")){%>
            <WELCOME>
                <NOME><%=loginManagement.getNome()%></NOME>
                <COGNOME><%=loginManagement.getCognome()%></COGNOME>
                <CREDITI><%=loginManagement.getCrediti()%></CREDITI>
            </WELCOME>
        <%}%>
        <%if(output.equals("login")){%>
            <LOGIN></LOGIN>
        <%}%>
        <%if(output.equals("error")){%>
            <ERROR><%=loginManagement.getErrorCode()%></ERROR>
        <%}%>
        </ROOT>
    </c:set>
    <x:parse xml="${xmlDocument}" var="xml"/>
    <c:set var="xslUrl"><%="/XSL/Login.xsl"%></c:set>
    <c:import var="xslDocument" url="${xslUrl}" scope="page"></c:import>
    <x:parse var="xsl" xml="${xslDocument}"/>
    <x:transform xml="${xml}" xslt="${xsl}"/>###################### END #########################
    ################## SECOND TAGLIB SECTION ###########
    <c:set var="xmlDocument" scope="page">
        <ROOT>
        <c:if test="${pageScope.output == 'welcome'}">
            <WELCOME>
                <NOME><c:out value="${loginManagement.nome}"></c:out></NOME>
                <COGNOME><c:out value="${loginManagement.cognome}"></c:out></COGNOME>
                <CREDITI><c:out value="${loginManagement.crediti}"></c:out></CREDITI>
            </WELCOME>
        </c:if>
        <c:if test="${pageScope.output == 'login'}">
            <LOGIN></LOGIN>
        </c:if>
        <c:if test="${pageScope.message != null }">
            <ERROR><c:out value="${loginManagement.errorCode}"></c:out></ERROR>
        </c:if>
        </ROOT>
    </c:set>
    <x:parse xml="${xmlDocument}" var="xml"/>
    <c:set var="xslUrl"><%="/XSL/Login.xsl"%></c:set>
    <c:import var="xslDocument" url="${xslUrl}" scope="page"></c:import>
    <x:parse var="xsl" xml="${xslDocument}"/>
    <x:transform xml="${xml}" xslt="${xsl}"/>###################### END #########################
    can u help me to understand why the second section doesn't works? if i'll be ogliged to use the first one, i won't be able to completely write code using taglibs, and so my code will be horrible! a mix of scriptlets syntax and taglibs' xml one.
    Compiling jsp with netbeans 4.0 the error is:
    Compiling 1 source file to /home/ghido/WebProjects/WebDocumentationXML/build/generated/classes
    /home/ghido/WebProjects/WebDocumentationXML/build/generated/src/org/apache/jsp/Login_jsp.java:252: jspxmeth_c_if_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.Login_jsp cannot be applied to (org.apache.taglibs.standard.tag.el.core.SetTag,javax.servlet.jsp.PageContext)
    if (_jspx_meth_c_if_0(_jspx_th_c_set_0, jspxpage_context))
    ^
    /home/ghido/WebProjects/WebDocumentationXML/build/generated/src/org/apache/jsp/Login_jsp.java:256: jspxmeth_c_if_1(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.Login_jsp cannot be applied to (org.apache.taglibs.standard.tag.el.core.SetTag,javax.servlet.jsp.PageContext)
    if (_jspx_meth_c_if_1(_jspx_th_c_set_0, jspxpage_context))
    ^
    /home/ghido/WebProjects/WebDocumentationXML/build/generated/src/org/apache/jsp/Login_jsp.java:260: jspxmeth_c_if_2(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.Login_jsp cannot be applied to (org.apache.taglibs.standard.tag.el.core.SetTag,javax.servlet.jsp.PageContext)
    if (_jspx_meth_c_if_2(_jspx_th_c_set_0, jspxpage_context))
    ^
    /home/ghido/WebProjects/WebDocumentationXML/build/generated/src/org/apache/jsp/Login_jsp.java:292: jspxmeth_c_out_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.Login_jsp cannot be applied to (org.apache.taglibs.standard.tag.el.core.IfTag,javax.servlet.jsp.PageContext)
    if (_jspx_meth_c_out_0(_jspx_th_c_if_0, jspxpage_context))
    ^
    /home/ghido/WebProjects/WebDocumentationXML/build/generated/src/org/apache/jsp/Login_jsp.java:296: jspxmeth_c_out_1(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.Login_jsp cannot be applied to (org.apache.taglibs.standard.tag.el.core.IfTag,javax.servlet.jsp.PageContext)
    if (_jspx_meth_c_out_1(_jspx_th_c_if_0, jspxpage_context))
    ^
    /home/ghido/WebProjects/WebDocumentationXML/build/generated/src/org/apache/jsp/Login_jsp.java:300: jspxmeth_c_out_2(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.Login_jsp cannot be applied to (org.apache.taglibs.standard.tag.el.core.IfTag,javax.servlet.jsp.PageContext)
    if (_jspx_meth_c_out_2(_jspx_th_c_if_0, jspxpage_context))
    ^
    /home/ghido/WebProjects/WebDocumentationXML/build/generated/src/org/apache/jsp/Login_jsp.java:404: jspxmeth_c_out_3(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext) in org.apache.jsp.Login_jsp cannot be applied to (org.apache.taglibs.standard.tag.el.core.IfTag,javax.servlet.jsp.PageContext)
    if (_jspx_meth_c_out_3(_jspx_th_c_if_2, jspxpage_context))
    ^
    7 errors
    Can you help me??
    And also, is the "pageContext.setAttribute()" method the correct way to select output as i did, or do u know a better one?
    Thanks a lot, bye.

    Use the brace notation.
    ${sessionScope['org.apache.struts.action.LOCALE']}

  • Please Help::How to display a Map with LIsts as Keys and Values using JSTL

    Hi,
    I need some assistance on how to display a Map in JSP using struts or core JSTL. I have a HashMap which has a List of keys and each key maps to a value of an ArrayList.i.e I have an ArrayList of taxCodes and each taxCode maps to a value of taxDetails which is an ArrayList of details for for that particular taxCode. I have some trouble to display each taxCode then display taxDetails for each taxCode. Here is my code below:
    OrderDetails.java
    package orderitems;
    import java.sql.*;
    import java.util.*;
    public class OrderDetails {
        private LineOder lineOrder;
        private Map lineItems;
        //returns an item number, key_item, from its unique keys
        public int getItemNumber(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            int itmNum = 0;
             * key_item a unique number for an item.
             * key_year,key_office,key_client,key_company unique keys
             * for each order where this key_item is taken
             * from.
            String select = "SELECT key_item FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + key_item +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                if(rst.next()){
                    itmNum = Integer.parseInt(rst.getString("key_item"));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itmNum;
        //get a list of item number(item codes)
        public List getAllItemNumbers(String key_year,
                String key_office,String key_client,String key_company){
            List itemNumbers = new ArrayList();
            LineItem itemNumber = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            String select = "SELECT key_item FROM "+ Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    itemNumber = new LineItem();
                    itemNumber.setKey_item(Integer.parseInt(rst.getString("key_item")));
                    itemNumbers.add(itemNumber);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemNumbers;
        //get a list of tax codes
        public List getAllTaxCodes(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            ItemTax taxCode;
            List taxCodes = new ArrayList();
            int itemNum = getItemNumber(key_item, key_year,
                    key_office,key_client,key_company);
            String select = "SELECT key_tax_code FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + itemNum +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    taxCode = new ItemTax();
                    taxCode.setKey_tax_code(rst.getString("key_tax_code"));
                    taxCodes.add(taxCode);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return taxCodes;
        /////This methode returns a Map which am trying to display in JSP
        //use tax code to get tax details
        public Map getItemTaxDetails(String key_year,String key_office,
                String key_client,String key_company,int key_item){
            ItemTax taxDetail = null;
            List taxDetails = new ArrayList();
            List itemTaxCodes = new ArrayList();
            Map itemTaxDetails = new HashMap();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //get a list of all tax codes of an item with a
            //given item number
            itemTaxCodes = getAllTaxCodes(key_item,key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator taxCodeIter= itemTaxCodes.iterator(); taxCodeIter.hasNext();){
                    ItemTax itemTaxCode = (ItemTax)taxCodeIter.next();
                    String taxCode = itemTaxCode.getKey_tax_code();
                    String select = "SELECT tax_type,tax_value," +
                            "tax_limit_val FROM "+ Constants.WEB_TABLE +
                            " WHERE key_item = "+ key_item +
                            " AND key_year = '" + key_year + "'" +
                            " AND key_office = '" + key_office + "'" +
                            " AND key_client = '" + key_client + "'" +
                            " AND key_company = '" + key_company +"'" +
                            " AND key_tax_code = '" + taxCode + "'";
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        taxDetail = new ItemTax();
                        //records to be displayed only
                        taxDetail.setKey_item(Integer.parseInt(rst.getString("key_item")));
                        taxDetail.setTax_value(rst.getString("tax_value"));
                        taxDetail.setTax_limit_val(Float.parseFloat(rst.getString("tax_limit_val")));
                        //////other details records ommited//////////////////////////
                        taxDetails.add(taxDetail);////An ArrayList of taxDetails for each taxCode
                     * A HashMap which has all taxCodes of an item as its keys
                     * and an ArrayList of taxdetails as its values.
                     * I return this for display in a JSP.
                    itemTaxDetails.put(taxCode,taxDetails);
                System.out.println();
                System.out.println("*********CONSOLE OUTPUT*************");//display on console
                Set set = itemTaxDetails.keySet();
                Iterator iter = set.iterator();
                System.out.println("Key\t\tValue\r\n");
                while (iter.hasNext()) {
                    Object taxCode=iter.next();
                    Object details=itemTaxDetails.get(taxCode);
                    System.out.println(taxCode +"\t" + details);
                System.out.println("************************************");
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemTaxDetails;
        //details of an item with all its taxes
        public List getAllItemDetails(String key_year,
                String key_office,String key_client,String key_company){
            List lineItems = new ArrayList();
            List itemNumbers = new ArrayList();
            Map taxDetails = new HashMap();
            LineItem item = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //A list of all item numbers in the declaration
            itemNumbers = getAllItemNumbers(key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator itemIter= itemNumbers.iterator(); itemIter.hasNext();){
                    LineItem itemNum = (LineItem)itemIter.next();
                    int itemNumber = itemNum.getKey_item();
                    String select = "SELECT item_description,item_mass," +
                            "item_cost" +
                            " FROM " + Constants.WEB_TABLE +
                            " WHERE key_year = '"+key_year+"'" +
                            " AND key_office = '"+key_office+ "'"+
                            " AND key_client = '"+key_client+ "'"+
                            " AND key_company = '"+key_company+ "'"+
                            " AND key_item = " + itemNumber;
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        item = new LineItem();
                        item.setItem_description(rst.getString("item_description"));
                        item.setItem_mass(Float.parseFloat(rst.getString("item_mass")));
                        item.setKey_item(Integer.parseInt(rst.getString("item_cost")));
                        //////other details records ommited//////////////////////////
                        /* A HashMap of all itemTaxeCodes as its keys and an
                         * ArrayList of itemTaxedetails as its values
                        taxDetails = getItemTaxDetails(item.getKey_year(),item.getKey_office(),
                                item.getKey_client(),item.getKey_company(),item.getKey_item());
                        //item tax details
                        item.setItmTaxes(taxDetails);
                        //list of items with tax details
                        lineItems.add(item);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineItems;
        public Set getOrders(String key_year,String key_office,
                String key_client,String key_company){
            List lineItems = new ArrayList();
            Set lineOrders = new HashSet();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            LineOder lineOrder = null;
            String select = "SELECT * FROM " + Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    lineOrder = new LineOder();
                    lineOrder.setKey_year(rst.getString("key_year"));
                    lineOrder.setKey_office(rst.getString("key_office"));
                    lineOrder.setKey_client(rst.getString("key_client"));
                    lineOrder.setKey_company(rst.getString("key_company"));
                    ////list of items with all their details
                    lineItems = getAllItemDetails(lineOrder.getKey_year(),lineOrder.getKey_office(),
                            lineOrder.getKey_client(),lineOrder.getKey_company());
                    //setting item details
                    lineOrder.setItems(lineItems);
                    //a list of order with all details
                    lineOrders.add(lineOrder);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineOrders;
    Controller.java
    package orderitems;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Controller extends HttpServlet {
        private Map taxDetails = new HashMap();
        private OrderDetails orderDetails = null;
        protected void processRequest(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            String key_year = "2007";
            String key_office = "VZX00";
            String key_company = "DG20";
            String key_client =  "ZI001";
            int key_item = 1;
            String nextView = "/taxdetails_list.jsp";
            orderDetails = new OrderDetails();
            taxDetails = orderDetails.getItemTaxDetails(key_year,key_office,
                    key_company,key_client,key_item);
            //Store the collection objects into HTTP Request
            request.setAttribute("taxDetails", taxDetails);
            RequestDispatcher reqstDisp =
                    getServletContext().getRequestDispatcher(nextView);
            reqstDisp.forward(request,response);
        protected void doGet(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
    taxdetails_list.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <title>Simple Tax Detail Diaplay ::</title>
            <link rel="stylesheet" type="text/css" href="imgs/orders.css"/>
        </head>
        <body>
            <jsp:useBean id="taxDetails" class="java.util.HashMap" scope="request"/>
            <table>
                <c:forEach items="${taxDetails}" var="hMap">
                    <tr>
                        <td><c:out value="${hMap.key}" /></td>
                        <!--td><%--c:out value="${hMap.value}" /--%></td-->
                    </tr>
                </c:forEach>
            </table>
        </body>
    </html>am displaying taxCodes(in this case i have VAT and ICD) fine but cant figure out how to display a list of value for each taxCode.Here is the output am getting
    both in my JSP and on the console:
    *******************************CONSOLE OUTPUT****************************
    Key          Value
    ICD     [orderItems.ItemTax@13e6226, orderItems.ItemTax@9dca26]
    VAT [orderItems.ItemTax@13e6226, orderItems.ItemTax@9dca26]
    Edited by: aiEx on Oct 8, 2007 6:54 AM

    hi evnafets,
    yes i need a nested for loop.I have tried your advice but my bean properties are not found.Am getting this error:
    javax.servlet.ServletException: Unable to find a value for "key_item" in object of class "java.lang.String" using operator "."
    I have tried this as stated earlier in the post:I have tried to make the method getItemTaxDetails return a List and get the returned list value as taxDetails. I then tested to display this list on JSP and its displaying fine.
    public List getItemTaxDetails(String key_year,String key_office,
                String key_client,String key_company,int key_item){
            ItemTax taxDetail = null;
            List taxDetails = new ArrayList();
            List itemTaxCodes = new ArrayList();
            Map itemTaxDetails = new HashMap();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //get a list of all tax codes of an item with a
            //given item number
            itemTaxCodes = getAllTaxCodes(key_item,key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator taxCodeIter= itemTaxCodes.iterator(); taxCodeIter.hasNext();){
                    ItemTax itemTaxCode = (ItemTax)taxCodeIter.next();
                    String taxCode = itemTaxCode.getKey_tax_code();
                    String select = "SELECT tax_type,tax_value," +
                            "tax_limit_val FROM "+ Constants.WEB_TABLE +
                            " WHERE key_item = "+ key_item +
                            " AND key_year = '" + key_year + "'" +
                            " AND key_office = '" + key_office + "'" +
                            " AND key_client = '" + key_client + "'" +
                            " AND key_company = '" + key_company +"'" +
                            " AND key_tax_code = '" + taxCode + "'";
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        taxDetail = new ItemTax();
                        //records to be displayed only
                        taxDetail.setKey_item(Integer.parseInt(rst.getString("key_item")));
                        taxDetail.setTax_value(rst.getString("tax_value"));
                        taxDetail.setTax_limit_val(Float.parseFloat(rst.getString("tax_limit_val")));
                        //////other details records ommited//////////////////////////
                        taxDetails.add(taxDetail);////An ArrayList of taxDetails for each taxCode
                     * A HashMap which has all taxCodes of an item as its keys
                     * and an ArrayList of taxdetails as its values.
                     * I return this for display in a JSP.
                    itemTaxDetails.put(taxCode,taxDetails);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            //return itemTaxDetails;
            return taxDetails;
        }And my JSP
    taxdetails_list.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!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">
            <link rel="stylesheet" type="text/css" href="imgs/orders.css"/>
        </head>
        <body>
            <table>
                <c:forEach var="curRecord" items="${taxDetails}" varStatus="rowCounter">
                        <c:choose>
                            <c:when test="${rowCounter.count % 2 == 0}">
                                <c:set var="rowStyle" scope="page" value="odd" />
                            </c:when>
                            <c:otherwise>
                                <c:set var="rowStyle" scope="page" value="even" />
                            </c:otherwise>
                        </c:choose>
                        <tr class="${rowStyle}">
                            <td>${curRecord.key_item}</td>
                            <td>${curRecord.tax_value}</td>
                            <td>${curRecord.tax_limit_val}</td>
                        </tr>
                    </c:forEach>
            </table>
        </body>
    </html>I can't see where am going wrong even with your advice.Please help.
    Thnx.

  • Problem with JSTL 1.0.6 in WLS 8.1.4 - Please Help

    I am trying to use JSTL 1.0.6 in WLS 8.1.4. Here are the steps I followed:
              <br>
              Step 1:
              Copied the following jar files to WEB-INF/lib directory:<br>
              - jaxen-full.jar<br>
              - jdbc2_0-stdext.jar<br>
              - jstl.jar<br>
              - saxpath.jar<br>
              - standard.jar<br>
              - xalan.jar<br>
              - xercesImpl.jar<br>
              - xml-apis.jar<br>
              <br>
              Step 2:
              Imported JSTL into my one-and-only JSP page as follows:<br>
              <%@ page contentType="text/html;charset=UTF-8" language="java" %>
              <%@ taglib prefix="c"<br>uri="http://java.sun.com/jstl/core" %>
              <%@ taglib prefix="c_rt" uri="http://java.sun.com/jstl/core_rt" %>
              <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml"%>
              <%@ taglib prefix="x_rt" uri="http://java.sun.com/jstl/xml_rt" %>
              <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
              <%@ taglib prefix="fmt_rt" uri="http://java.sun.com/jstl/fmt_rt" %>
              <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
              <%@ taglib prefix="sql_rt" uri="http://java.sun.com/jstl/sql_rt" %>
              <br><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
              <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
              <br>
              <br>
              (I am also using struts, hence the last two page directives)
              <br>
              <br>
              Step 3:
              Finally I tried to build an EAR (which used to build OK before I added JSTL) using a slightly modified version of the build.xml that comes with the Medrec tutorial. wlcompile went OK, but <b>wlappc</b> failed with the following message:
              <br>
              java.lang.NoClassDefFoundError: javax/servlet/jsp/el/VariableResolver
              <br>
              <br>
              What am I doing wrong? I followed the instructions given in the JSTL 1.0.6 package. Is wlappc not the right tool for translating/compiling the JSP?
              <br>
              Please help!
              <br>
              <br>
              Regards,
              Nadeem

    I can't be sure about exactly what's happening here, but I can point out several things.
              The class "javax.servlet.jsp.el.VariableResolver" is associated with JSTL 1.1.x, and JSP 2.0. It's not part of JSTL 1.0.x. Make sure you really have version 1.0.6, and don't have 1.1 somewhere.
              If you're just trying to use the JSTL, you shouldn't need several of those jars that you're presently including. You only need jstl.jar and standard.jar.
              Why are you using the "rt" versions of these taglibs? Those don't even use the expression language. I would remove "_rt" from all of those references.
              Note that if you're using Struts and the JSTL, you probably want to use Struts-EL, which is a version of the Struts jar that uses the EL to evaluate attribute values. Check the struts-user archive for some information about this. You'll find the struts-el distribution in the "contrib" directory of the Struts distribution.

  • Help about JSTL: I can't use c:if .. in option.. !

    Hi, all
    I build my project on STRUTS before, and using the tableligs of struts,But now ,I find it is a good choice using JSTL.However ,problems accurred as follows:
    (my project is on Eclipse and Tomcat)
    In the page , I have already include that:
    <%@ taglib uri="/jstl/core" prefix="c" %>
    <%@ taglib uri="/jstl/fn" prefix="fn" %>
    <%@ page isELIgnored="false"%>
    In web.xml, I added that :
    <taglib>
    <taglib-uri>/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/jstl/fn</taglib-uri>
    <taglib-location>/WEB-INF/fn.tld</taglib-location>
    </taglib>
    Problem occur here:
    <select name="category">
    <option value="IM1" <c:if test="${CCOption == 0}"> selected</c:if> ><bean:message key="IM1"/></option>
    but the system told that " undefined attribute name <c:if .... " that is to say, they cannot find the tag in this page,but I have try to put the <c:if to ..>out , not in the <option...> ,then that is OK.
    But in fact ,we can use the tag <c:if....> in such as <option...> and so on . I don't know why I can't.
    By the way, in jslt 1.1, JSTl.jar/standard.jar have 15 .tld files , I don't
    know what are the differences among the file c-1_0-rt.tld, c-1_0.tld and c.tld(which are inclued in the 15 tld files)?How can I set up JSTL in my Tomcat?
    Look forward for your help!
    Many thanks in advance!

    You may find it useful to go and read [url http://forum.java.sun.com/thread.jspa?threadID=629437&tstart=0] this post. (reply #6)
    Basically you are making a whole lot of work for yourself that you don't need.
    JSTL doesn't need the tld files in WEB-INF.
    It doesn't need entries in web.xml
    All it needs is you to use the standard import URI: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    So get rid of those tlds. Leave them hidden inside the jar file. Tomcat will find them there.
    The other thing of not is the <%@ page isELIgnored="false"%> attribute you have.
    You only need this because your web.xml is defining itself as version2.3.
    If you update your web.xml to version2.4, EL is enabled by default
    Hope this helps,
    evnafets

  • Help about EL/JSTL usage

    Hello,
    When we declare any bean on jsp using jsp:useBean i read that we can use that bean either in scriptlets or in expressions on jsp.
    Im not clear about the same when we create any variable using JSTL like <c:set var="jspBean" value="myname"/>
    as i know EL variables cannot be used in scriptlets or expressions, can they be used only in JSTL tags involving EL or we can use it any where.
    Also, can we use JSTL in between some html formatting tags like <div> , <table>, <span> etc like :
    <div <c:if test="${jspBean == 'myname'}"> style="width:9px;"</c:if> >
    some text
    </div>
    If there is any nice tutorial/notes that shows the usage of EL, please let me know.
    Please help me with my above questions

    Best way to learn is to experiment :-)
    Originally ${expr} only worked within specifically written tags.
    Since JSP2.0, ${expr} can be used anywhere that you can use <%= expr %> - they are now both runtime expressions evaluated by the container (eg Tomcat 5)
    Also, can we use JSTL in between some html formatting tags like <div> , <table>, <span> etc like :Yes. It will evaluate at runtime, and produce an HTML page to send to the client. The EL/JSTL gets evaluated on the server, the client never sees the if statement.
    I would recommend reading the JSTL specification: http://java.sun.com/products/jsp/jstl/reference/api/index.html.
    Cheers,
    evnafets

  • Accessing a array stored in database through JSTL, need urgent help

    Hi,
    I have a database table which contains a column storing the following structure:
    Column Name:- Score_Data
    Stores a structure in each row,
    Structure Name:- Score_Datatype
    Structure Values:- ScoreNumArray integer[], ScoreNAType character(2)
    My aim is to access ScoreNumArray values and show it in a drop down box using JSTL.
    Can someone please help me
    Thanks
    Saurabh.

    Thanx for the prompt reply,
    Actually the requirment is that my dropdown has following values 0,1,2,NA or 0,1,2,3,NA or 0,1,NA and so on....
    thats why I made a user defined type in database(postgresql) and than storing int and char in it.
    Can this be done through JSTL.
    When I use the following code:
    *<%@ include file="/html/common/init.jsp" %>
    <% pageContext.setAttribute("colors",
    new String[] {"red","green","blue","orange","black"} ); %>
    <sql:query dataSource="jdbc:postgresql://10.10.33.39:5432/globus_db,org.postgresql.Driver,postgres,marines@123" sql="select
    (\"Score_Data\").\"ScoreNumArray\" from \"Opex_Subparameters_Values_B\" where \"Short_Name\"='cs'" var="artists"/>
    <table>
    <c:forEach items="${ artists.ScoreNumArray }" var="row">
    <c:forEach var="n" items="${row}"
    varStatus="a">
    <tr>
    <td> <c:out value="${a.index}" /> </td>
    <td> <c:out value="${a.current}" /> </td>
    <td> <c:out value="${a.count}" /> </td>
    <td> <c:out value="${a.first}" /> </td>
    <td> <c:out value="${a.last}" /> </td>
    <tr>
    </c:forEach>
    </c:forEach>
    </table> *
    I get no values for a.current, means it shows nothing.
    Please suggest.
    Thanks,
    Saurabh.

  • Help with downloading JSTL library

    Hi everyone,
    I've just started doing my second year degree in Multimedia Computing and am doing a year long module in JSP. I've installed Tomcat and everything at home but I'm having trouble getting my code to work which I've copied out of my book to see how it works. This is what I have written in JPadPro...
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <c:set value="Tiddles" var="myCat" />
    <c:set var="myDbId" scope="application">jdbc:mysql://localhost/eg02dsdb</c:set>
    <html>
    <head>
    <title> Question 1 </title>
    </head>
    <body>
    <p>
    myCat is
    <c:out value="${pageScope.myCat}" default="No myCat object on this page"/>
    myDbId is
    <c:out value="${applicationScope.myDbId}" default="No myDbId object in this application"/>
    </p>
    </body>
    </html>
    When I come to open the JSP file in http://localhost:8080 a message appears stating....
    The server encountered an internal error () that prevented it from fulfilling this request.
    org.apache.jasper.JasperException: File "/WEB-INF/tld/c.tld" not found
    After doing some research on the Internet I figured that I might need to download the JSTL core library off Apache's website. However when I get to the download page I don't have a clue which link to click on and what to do fromt there. There's loads of links saying things like BCSL, Cactus etc and they all have a link beside them that says KEYS and two files under each, one a .zip and the other a tar.gz but I don't have a clue which links I have to click on or anything. I have seen a few Tomcat links but don't know whether I should click on them. I just don't want to download the wrong stuff and mess up and files that are already in place in my j3t folder. If anyone could help me I'd really appreciate it! Thank you so much.
    Joe P

    I don't know how to award the duke points but i'll do that in a sec for you. I do have mySQL on the machine but I don't have it running. That may be why, as for the classes and that, I haven't created any. I simply copied the code out of this workbook my lecture created as an example. That may be the reason the code doesn't work, its probably because I don't have the classes he created on machine. I did just try doing a simple mathematical equation in the JSP file though and that produced the following results...
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <c:set value="Tiddles" var="myCat" />
    <c:set var="myDbId" scope="application">jdbc:mysql://localhost/eg02dsdb</c:set>
    <html>
    <head>
    <title> Question 1 </title>
    </head>
    <body>
    <p>
    myCat is
    <c:out value="${pageScope.myCat}" default="No myCat object on this page"/>
    myDbId is
    <c:out value="${applicationScope.myDbId}" default="No myDbId object in this application"/>
    3+4+*5=
    <c:out value="${3+4*5}"/>
    </p>
    </body>
    </html>
    myCat is ${pageScope.myCat}
    myDbId is ${applicationScope.myDbId}
    3+4+*5= ${3+4*5}
    I'll award you these duke points now, thank you for trying to help me, sorry I'm a bit slow with understanding all this, I did a lot of quite simple java last year but it wasn't one of my favourite subject areas.

  • Help about JSTL

    can u please help me out.......
    i am new to JSTL can u plese tell me do i requirements like jars for implementing JSTL
    Thanks in advance........
    Bye..............

    You need to install JSTL.
    You can download from here:
    http://jakarta.apache.org/site/downloads/downloads_taglibs.html
    Download:
    JSP1.2 container (eg Tomcat 4) : Standard 1.0 Taglib
    JSP2.0 container (eg Tomcat 5) : Standard 1.1 Taglib
    Make sure you get the right version for your server.
    Read the readme with the download. It details any requirements.
    Most of them are included as standard with java 1.4.2
    To install: copy standard.jar and jstl.jar to your web-inf/lib directory
    Good luck,
    evnafets

  • Help me in JSTL. Its Urgent

    <logic:iterate id="ddd" name="mainForm" property="depts" type="com.ex.form.DeptForm" indexId="ctr">
                   <tr>
                        <td>               
                             <html:checkbox name="mainForm" property='<%= "depts[" + ctr + "].select" %>'/>
                        </td>          
    I want to gain the same functionality using JSTL. Here is what I am doing.
                             <c:set var="Count" value="0" scope="page" />
                                  <c:forEach var="summaryList" items="${MainForm.dept}" begin="${MainForm.startValue}" end="${MainForm.endValue}">
                                       <c:if test="${rowCount%2 > 0}" >
                                            <tr>
                                       </c:if>
                                       <c:if test="${rowCount%2 == 0}" >
                                            <tr bgcolor="#eeeeee" >
                                       </c:if>
                             <td>
                                  <html:checkbox name="summaryList" property="selected" />
                             </td>
    But the field selected is not populated in the DeptForm which is an array in the MainForm. This is working fine when using logic:iterate but not with JSTL. Please help how to do using JSTL. Its urgent.

    <logic:iterate id="ddd" name="mainForm"
    property="depts" type="com.ex.form.DeptForm"
    indexId="ctr">
                   <tr>
                        <td>               
    <html:checkbox name="mainForm" property='<%=
    ='<%= "depts[" + ctr + "].select" %>'/>
                        </td>          
    I want to gain the same functionality using JSTL.
    Here is what I am doing.
    <c:set var="Count" value="0" scope="page" />
    //So in the code above you used "MainForm.depts" here you use "MainForm.dept" which is correct?
    <c:forEach var="summaryList" items="${MainForm.dept}"
                     begin="${MainForm.startValue}" end="${MainForm.endValue}">
        //Where does the value of "rowCount" come from?  Where is is being incremented? 
        //Look up the JSTL docs for c:ForEach tag and see how to use the varStatus object.
        <c:if test="${rowCount%2 > 0}" >
            <tr>
        </c:if>
        <c:if test="${rowCount%2 == 0}" >
            <tr bgcolor="#eeeeee"  >
        </c:if>
        <td>
            <html:checkbox name="summaryList" property="selected" />
        </td>
    But the field selected is not populated in the
    DeptForm which is an array in the MainForm. This is
    working fine when using logic:iterate but not with
    JSTL. Please help how to do using JSTL. Its urgent.

  • Help needed with JSTL

    I need to access internal information of a certain object that I created from servlet.
    when I do this
    <h1><c:out value='${content}' /></h1>
    this one returns toString() value of the object.
    But I also need to access
    Object.getName(), Object.getDescription - which returns
    private String _name;
    private String _description; of the object.
    how can I do it?
    <h1><c:out value='${content.getName()}' /></h1>
    or
    <h1><c:out value='${content._name}' /></h1>
    didnt work?
    thanks

    firs,t thanks much for the help.
    but your answer is what's been confusing me about JSTL. which determines the value after name_of_the_object. ?
    none of the documents say whether it is public or private value of the class object, or name of the getter/setter(if i have getName(), then is it Name?).
    thanks again!

Maybe you are looking for

  • Any ideas for reducing lag in my animation (flash cs6)?

    I'm creating something for a local college in Flash CS6 and it lags in a couple spots (in the very beginning after clicking enter and after clicking on a location on the map) and it would obviously be really nice to get rid of that lag. The only thin

  • I'm starting to get fed up

    Alright, before I get into the issue, I want to give some background first. I am a previous owner of a Silver Creative Zen Micro (5 GB), and enjoyed it for a good 4 months before the headphone jack problem reared its ugly head. So $25, 3 weeks, and a

  • XML and Air Issues

    Hi guys, first time poster so I apologize if this is a basic question! I am creating a Media cataloging application to run as a desktop application through Air, I initially built this as a Flex web app but have decided I want it as a standalone. Anyw

  • What does error 400-1 mean?

    How do you fix the problem with error 400-1 so that the "Watch Disney Jr" live will work?

  • How do I stop CD's disappearing when i am trying to import

    When I try to import a CD into iTunes 1 the CD shows up on the desktop as audio CD 2 iTunes goes off and queries Gracenote and downloads the track details which flash up in iTunes 3 suddenly the disk disappears from the desktop and cannot be seen as