JSTL JSP

I have downloaded jstl1.0 implementaion binary files from jakarta site and I have placed the standard.jar and jstl.jar in my /WEB-Inf/lib directory and I have placed the c.tld under /WEB-Inf/tlds directory, and added the following lines in web.xml
<taglib>
     <taglib-uri>/jstlcore</taglib-uri>
     <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
</taglib>
and in my test.jsp i have added the following line after <@ page...>
<%@ taglib uri="/jstlcore" prefix="c" %>
I added
32: <c:set var="test" value="test-value"/>
33: <c:out var="test"/>
when I try to compile the test.jsp file, I get the following error.
test.jsp [32:0] Unable to load class null
can someone help use JSTL, please provide me with some examples or proper information to use JSTL in my jsp's.
Thanks

Gotcha :)
Problem I have earlier version of Tomcat 4.0.4..which is required for jstl 1.0 standard release. Now looking for jakarta-taglibs-standard-oldxml-compat.zip on jakarta site..couldn't find..
once I find that zip file
I have to install them (crimson.jar and
xalan.jar) into WEB-INF/lib directory in place of the following files
from this distribution: jaxp-api.jar, dom.jar, sax.jar, xercesImpl.jar,
and the newer xalan.jar.
Basically I am using tomcat integrated in forte for java...so gotto see how can i upgrade to newer version...
anyway thanks for help and time.

Similar Messages

  • JSTL, JSP Batch Update

    I need to do something like a batch update in one of my JSP pages, but not sure on how to do this.
    For example, instead of opening and updating just one row in my db table, I need to update multiple rows at the same time, how can i do this in JSP/SQL.
    thanks.

    Again, not a thing you would really want to do in jsp/jstl.
    Write it in java code, using the JDBC library directly.
    There are batch processing commands in the jdbc library:
    addBatch, executeBatch.
    Check out the java.sql API for details.

  • New to JSTL: jsp variable translated literally within the custom tag

    I have a basic custom tag that simply processes greeting. Neither of the below scenarios works and I am trying to understand why
    <%
    String name = (String)request.getParameter( "name" )
    %>
    <custom:greeting name="<%= name %>"/>
    <%
    pageContext.setAttribute( "name", name );
    %>
    <custom:greeting name="${name}"/>
    If you have any suggestions, I look forward to hearing from you.

    When i ran the code I get my "Hello <%= name %> "or "Hello ${name} "
    My source
    public class HelloTag extends TagSupport{
    public String name = "World";
    public void setName( String value )
    name = value;
    public int doEndTag()
    try{
    pageContext.getOut().println( "Hello " + name );
    }catch( IOException e){}
    public HelloTag()
    super();
    What do you mean by jsp level. It resides in my Root directory under Tomcat

  • Is it possible to do this in JSTL / JSP - JavaBean with static properties ?

    javaBean:
    public class Util {
      private static String s;
      public static void setS(String s) { this.s = s; }
      public static getS() { return s; }
    // some other static utilities needed to be called by other classes
    }JSP Page needs to output the value of s (the static value)
    Is it okay for the JavaBean used to have static values and static get and set?

    By the way, the correct way to write your static setS method (without this!) is:
    public static void setS(String s) { Util.s = s; }

  • How to access and display a Web Service from a WSDL in JSP or JSTL ?

    Dear All,
    We need to access a Web Service which is hosted as WSDL How to access a WSDL file from JSP or JSTL, parse and display the SOAP response in JSP page.
    Any simple example or URL as reference to an example will be useful for me.
    It seems io tags of jakarta is able to send soap message, but how to display it in JSP.
    Yours,
    Sankar.B

    Dear Sir,
    Yes. I would like to know more about the Forte and how to consume WSDL file from JSTL. The following are my querirs.
    1. How to connect the declared JNDI from a JSP page. i.e: the Datasource - ex: booksDS
    2. We connect the Tomcat server using JNDI as jdbc/scott. But, if I give jdbc/scott in JSTL as datasource={jdbc/scott}, we could not able to connect. We use the following code in a JSP page to connect the DB from a JSP page. (Its quite easy to modify, so we use the connection in a JSP page.)
    3. How to Consume a WSDL url from JSTL. Ex: If there is a URL : http://localhost/ws/MathService.asmx?wsdl OR http://www.xmethods.com/test/BabelFish
    4. How to display the result. We tried via SOAP from io taglib of Jakarta, but gives us an SOAP (it also looks like xml) response. But, how to use the value from that soap response in IE client thru JSTL/JSP.
    5. Whether this JSTL tool will be available with Forte Enterprise/Community Edition. If so EE, whats the price.
    Please Reply Immediatly. We tried, trying, going to try to display a wsdl response, but not able to display in IE thru JSP/JSTL. But, weve tested the www.gotdotnet.com examples of asp.net web services, we are thru. Its quite easy it seems in .NET. But, we feel whether even there is not even one example in JSTL/ Java Web Services Dev. Pack to utilise a web service in full cycle. The example which uve given is thru servlets. We dont use servlets. Cos, its very easy to edit JSP pages, instead of compiling the serv. and using it.
    I hope ull reply for all the above queries, since ur from SUN.
    Expecting your fav. reply.
    Yours,
    Sankar.B

  • JSP : latest  JSTL, File Upload from web form Client to Server Question!

    I understand that within a JSP, It is possible to read a file from the Client by opening a Stream somehow.
    How do I code, within jsp/servlet (non tag) java code inside <% %>
    blocks, WITHOUT openening a new connection to the URL, an InputStream from a client web browser form, from a file upload coded using
    <input type="file" name="file1"/> ?
    I have previously achieved this quite simply with a FileInputStream
    with the previous version of JSTL.
    How may I do this with the latest version of JSTL, with this index.jsp?
    -with a simple text file.
    -with a Binary file (with DataInputStream)?
    <%--
    Document : index
    Created on : 27/01/2009, 3:08:32 PM
    Author : Zachary Mitchell
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!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>JSP Page</title>
    </head>
    <body>
    <h1 align="center">Hello World!</h1>
    <form name="form1" method ="POST" >
    <table align="center">
    <tr>
    <td>
    <input name="file1" type="file" align="center"></input>
    </td>
    </tr>
    <tr>
    <td>
    <input type="submit" value="submit" action="index.jsp" ></input>
    </td>
    </tr>
    </table>
    </form>
    <!--*********************************************************************** -->
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <%@page import = "java.io.*" %>
    <c:if test="${pageContext.request.method=='POST'}">
    <%
    File fileName = new File(request.getParameter("file1"));
    out.println(fileName.toString());
    FileInputStream stream = new FileInputStream(fileName);
    out.println(stream.toString());
    %>
    </c:if>
    <!--*********************************************************************** -->
    </body>
    </html>

    If I have:
    <!-- ***********************************************************************************-->
    <form name="form1" method="POST" enctype="multipart/form-data">
    <input name="file1" type="file"/>
    <input name="submit1" type="submit" value="Submit" action="index.jsp"/>
    </form>
    <!-- ***********************************************************************************-->
    and run this in an index.jsp, use browse to select my text file, and click SUBMIT.
    I can use:
    InputStreamReader reader = new InputStreamReader(new DataInputStream(request.getInputStream()))
    BufferedReader bufferedReader = new BufferedReader(reader);
    bufferedReader.readLine();...
    However, these is some HTML/POST related content around what multiple readLine();
    calls return.
    Is there an easy way, like using "${param.file1}",
    aside from [http://commons.apache.org/fileupload/|http://commons.apache.org/fileupload/],
    maybe using servlet style code, to get the File contents from a remote Client,
    to the remote Server servlet engine, AVOIDING ANY SUPERFLUOUS CONTENT,
    using version 1.12 of the JSTL, JSP 2.0,Tomcat 6?
    Just politely, yes, no, and how?
    Edited by: Zac1234 on Jan 29, 2009 3:27 AM
    Edited by: Zac1234 on Feb 1, 2009 8:29 PM

  • UIX JSP equivalent for JSTL 'set'?

    Is there a UIX JSP tag that performs an analogous function to the JSTL tag 'set'? I would like to be able to setup local variables so that I don't have to repeat extended expressions.

    You can (generally) speaking use JSTL's set in UIX JSP pages, and (mostly) use JSTL JSP tags with UIX JSP tags.
    So, you should just be able to use <c:set>.
    The major complexity in integrating the two is remembering that JSTL sets and iterates immediately, but UIX JSP evaluates EL expressions only once the last UIX JSP tag completes. This doesn't cause much of a problem with <c:set> or <c:if>, but does cause some major problems with <c:forEach>.
    (A very similar problem is encountered when using JSTL tags with Java Server Faces JSP tags, so this is just a painful fact-of-life.)

  • Calling a method with parameters in jstl?

    i need to call a method with a series of String parameters what am i doing wrong?
    the java
        public ArrayList getEmployeeSkills(String ename, String snmae, String yearsexp)the jstl
        <jsp:useBean id="empskill" class="com.Database.EmployeeSkill"/>
        <c:forEach var="emp" items="${empskill.EmployeeSkills(null, null, null)}">
        </c:forEach>

    this works:
         <jsp:useBean id="empskill" class="com.Database.EmployeeSkill" scope="page">
             <jsp:setProperty name="empskill" property="ename" value="Helen Smith"/>
             <jsp:setProperty name="empskill" property="sname" value="Java"/>
         </jsp:useBean>but this part isnt:
         <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
         </c:forEach>ive removed the get part from the method as i have done before from the java class it is calling:
    public ArrayList getEmployeeSkillsReport()
    but it produces:
    org.apache.jasper.JasperException: Exception in JSP: /main.jsp:146
    143:      </jsp:useBean>
    144:      
    145:
    146:      <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
    147:      </c:forEach>
    148:                          
    149:    
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:244)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:109)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129)
         org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.evaluateExpressions(ForEachTag.java:155)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:66)
         org.apache.jsp.main_jsp._jspx_meth_c_forEach_3(main_jsp.java:590)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:232)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

  • Help needed in JSP application

    Hi... I am implementing one web application. The main file is index.html whch contain frame where following options are there.
    1. Login 2. Line Count. 3. Leave Balance 4. Extra. 5. Log out. but wht I want is, Once User logged in the options from 2to 5 must be visible..But first time only login option should be available..
    Hope you understand...and please tell me how can i do it
    Wether I have to create 2 page..one for login and another for rest of the options or some other way to do so??
    Thanks inadvance
    Regards
    Chintan

    There is a general feeling that scriptlets in JSP pages are a bad thing.
    They can make the page difficult to follow and understand.
    The syntax used above was from the JSTL - JSP Standard Template Library : http://java.sun.com/products/jsp/jstl/
    The JSTL tags provide a lot of functionality that previously was done in scriptlets.
    eg Looping, conditional branching, formatting, XML handling.
    Benefits: You don't have to constantly switch between java and html with <% %> tags. The code ends up looking much nicer.
    Also it is aimed at page authors, who don't necessarily understand java, but will understand using tags like this.
    Myself, I like it because of the first reason - it just makes the page so much easier to read when everything is in tags, as opposed to constantly switching from java to html and back - particularly with braces.
    You have to agree:
    <c:if test="${params.choice == 'yes'}">
      You said YES!
    </c:if>looks much better than
    <% if (request.getParameter("choice").equals("yes")){ %>
      You said YES!
    <% } %>Cheers,
    evnafets

  • Accessing the value in option Tag in html using JSTL

    Hi,
    Following is my code
    <select>
    <option value="1">one </option>
    <option value="2">Two</option>
    </select>
    Now, if I select two from the option, i need to get the value 2, using JSTL( JSP standard Tag Library).
    Can someone help me out.
    Thanks
    Achillies.

    You need to give the "select" component a name to submit under.
    <select name="yourChoice">
      <option value="1">one </option>
      <option value="2">Two</option>
    </select>When you submit this page, it will submit a parameter like yourChoice=2.
    In a servlet you retrieve this with request.getParameter("yourChoice");
    In JSTL/EL, you can use the param map: ${param.yourChoice}

  • Including output in a JSP page from a separate Web App

              I seem to be having a bit of a problem including the output from a sevlet invoked
              from a separate
              Web Application in the same domain. I have a servlet callsed 'WebApp2\Web-inf\classes\packagename\targetServlet'.
              I am attempting to invoke 'targetServlet' from 'WebApp1\somepage.jsp' using the
              jsp:include directive but I seem
              to be having a path problem because the servlet is not invoked. Anyone have any
              suggestions?
              

              Mark:
              You cannot do that with <jsp:include>. You can read the JSP spec to learn more
              about it.
              Anyway, there are some tags out there that do allow what you need. I, for one,
              use Struts' <bean:include> tag. See http://jakarta.apache.org/struts/
              The new JSTL (JSP Standard Tag Library - http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html)
              provides the <c:import> tag.
              Greetings
              "Mark Andersen" <[email protected]> wrote:
              >
              >I seem to be having a bit of a problem including the output from a sevlet
              >invoked
              >from a separate
              >Web Application in the same domain. I have a servlet callsed 'WebApp2\Web-inf\classes\packagename\targetServlet'.
              >I am attempting to invoke 'targetServlet' from 'WebApp1\somepage.jsp'
              >using the
              >jsp:include directive but I seem
              >to be having a path problem because the servlet is not invoked. Anyone
              >have any
              >suggestions?
              

  • How do I expand my simple JSP page to implement Connection Pooling?

    Hi everyone,
    I have a small SQL database which contains information about Students and a StudenBean which contains their attributes and appropriate get/set methods (which I haven't needed to use yet).
    I want to write a simple JSP page which displays all the students details in one big table. I can do this using the basic prototyping method of adding the dataSource and driver details to the deployment descriptor (web.xml - I'm using the latest version of Tomcat by the way) and then accessing the database using JSP standard SQL actions.
    Here's a snipet of what I've done (just an example, the final code works):
    <sql:query var="temp"
    sql="SELECT * FROM Employee ORDER BY UserName"
    />
    <c:forEach items="${temp.rows}" var="row">
    <td><c:out value ="${row.UserName}"/></td>
    <td><c:out value ="${row.FirstName}"/></td>
    <td><c:out value ="${row.LastName}"/></td>
    Now I want to upgrade! I want to access the dataSource using Connection Pooling and it's causing me a lot of trouble. I already have the required working classes/data such as ConnectionPool.java, ResourceManagerListener.java, the MySQL driver etc.
    However, I don't know what the best way to setup the connection for my purposes would be and where I should do it.
    Do I need to write a servlet or tag handler/custom action to establish the connection and access my bean through it? I would like to keep a similar sort of business logic as I already have developed i.e. be able to use actions in my JSP page to cycle through the database and print out each detail from the row.
    Rather confused and muddled. Thanks for any input!

    Good idea.
    Set up a JNDI data source for your app, according to these docs:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    You'll have to put the right information into your web.xml and a context.xml. Once you've done that, your JSTL JSPs will simply use the connection resource automagically.
    MOD

  • What is the use of jsp when compare with Struts

    what is the use of jsp when compare with Struts

    JSP Tag Libraries are great for reusable content formatting and ligic.
    For example, let's say you have this Shopping site. Each item you sell is stored in a database, and you get them out depending on Catagories, creating a List of ItemBeans. You allways want to display the items with a catagory header, then a <table> with the item number, the description and the price.
    Instead of creating a bunch of logic in the JSP that does this, you can pass it on to a Tag that might look like this in your JSP:
    <shopping:itemTable catagory="${selectedCatagory}" items="${itemsForCatagory}" />
    This would make the JSP easier to read and work with.
    The actual uses are incredible. Have you used the <jsp:useBean ...> tag? That is an example of a use of the Custom Tag Libraries.
    Furthermore, look into JSTL (JSP Standard Tag Libraries). They are a collection of tags (API by Sun, coding by Apache) used to do many of the standard actions you might want/need to do in JSPs, like a conditional tag (c:if only do something if the test is true), multiple-conditional tags (c:choos c:when c:otherwise) like an if [else if] else construct. Looping through an array or Collection (c:forEach), storeing values in scopes (c:set) formating numbers and dates (the fmt library), xml transformations (xml library), and lots of other things that you could replace scriptlet code with.

  • JSTL On Oracle Java Cloud

    I am trying to use JSTL tags in a JSP page but keep getting errors of the following nature.
    jstl.jsp:2:5: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file.
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    I see JSTL 1.2 on the whitelist, so this should have worked ok.
    BTW the JSP works fine if I manually add the JSTL jar files to my lib. However that kinds of defeats the purpose of JSTL.
    I would have expected the tags to work without me having to add any jar files.
    Please let me know.
    Thanks,
    Harshad

    Harshad ,
    Have you added JSTL shared library in your Weblog.xml deployment descriptor ?
    Please refer to Configuring JSF and JSTL Libraries - 11g Release 1 (10.3.6)

  • JSF or struts\JSP?

    Hello;
    I am creating a portlet.
    1) For the portal window, should I use HTML, DHTML, or Swing?
    2) If HTML, should I use struts/JSTL/JSP or JSF?
    3) What�s easiest for the UI development � IntelliJ/Dreamweaver, BEA�s Workshop, Java Studio Creator, Sun ONE Studio, or ???
    4) Any books or urls you can suggest for the above?
    thanks - dave

    http://www.coreservlets.com/JSF-Tutorial/
    => http://courses.coreservlets.com/Course-Materials/pdf/jsf/01-JSF-Intro.pdf

Maybe you are looking for

  • How to handle latency due Audio/Video live streams.

    Hi everybody reading this, I am using fms3.5 and the scenario that i wish to solve is that: 1) From a flex application client I start publishing a video at x bytes per second. 2) At the receiver's end, I start getting the video very fine at receiver,

  • HOW TO CAPTURE THE COMPANY CODE IN MIR7

    Hi ALL, MIRO data transfer i am facing some problem initially i am capturing the Company code in MIRO after that i am filling up all those values. for my requirement 1.i want to hold the company code screen initially at all time other wise 2. i am ge

  • New document type for value contract

    Dear Gurus I want to create new document type for value contract , can you suggest me the configuration as well as areas to be taken care. Advance thanks to all Regards Srinivas

  • Possible to use TC as clone of boot drive in Leopard?

    Time Machine seems to take FOREVER whenever I run it, so I end up not running it. I was wondering if it is possible to use Time Capsule as a pure hd and clone my boot drive to it for a full backup option? If so, how? Are there reasons not to?

  • SQL Anywhere 5.0

    Hi all, As we know this is very old version and be ended in 2000. Unfortunately, i need this software to cover my other database issue on Window NT 4.0. Does anybody still keep this version? Could you please help to share to me? Thanks in advance, Nh