Jsp and jstl

Hi ,
I was trying to use jstl to make my jsp's look clean and easliy manageable,but till now i have had no luck in making it work.
I have added all the tld's and jars required for jstl to my war file and also i made the entry in my web.xml,in my jsp i put
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
and the place where i wanted to put my if statement i wrote this code
<c:if test=${endVal==0}>
<c:set var="endVal" value=<%=result.size()%> />
</c:if>
I tried with both
uri="http://java.sun.com/jstl/core"
uri="http://java.sun.com/jstl/core_rt" but it doesnt seem to be setting that value.plz advise what is wrong.
Thanks

thanks panyong-cs !
Now atleast its tryign to set the value but the error i am getting is
"cannot resolve symbol
symbol : method setValue (int)
location: class org.apache.taglibs.standard.tag.rt.core.SetTag
_c_rt_set0.setValue(result.size()); "
resong being that result.size() is an int ....so now how should i set that value....

Similar Messages

  • API for jsp and jstl

    can any body send URL or help me to download JSP and JSTL API also servlets

    hi,
    Jsp api
    http://tomcat.apache.org/tomcat-5.0-doc/jspapi/index.htmlJstl api
    http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html

  • Help with JSP and JSTL tag

    I am trying to accomplish the following
    -display a checkbox if the phrase "platinum" appears in a string
    -display a radio button otherwise
    Here is my code:
    <c:when test="${fn:containsEqualIgnoreCase(${product.description}, 'platinum' })}">
                      <td width="40">
                       </td>
                     <td width="1">
                        <html-el:checkbox property="dishHDProduct"             value="${product.productId}:${product.presentationChannelText}:${product.programmingType}" disabled="true"/>                                                            
                                                                  </td>
                                                             </c:when>
                                                             <c:otherwise test="${fn:containsEqualIgnoreCase("platinum")}">
                                                                  <td width="1">
                                                                       <html-el:radio property="dishHDProduct" value="${product.productId}:${product.presentationChannelText}:${product.programmingType}"/>                                                            
                                                                  </td>
                                                             </c:otherwise>I suspect that I cannot use the <when> <otherwise> stuff with the function JSTL tag, but I may be wrong. I am new to this and open to all suggestions.
    Thanks!

    This is actually the way I ended up solving my own problem:
    <c:choose>
                                                             <c:when test="${product.presentationChannelText == 'PlatinumHD'}">
                                                                  <td width="10">
                                                                  </td>
                                                                  <td width="1">
                                                                       <html-el:checkbox property="dishHDProduct" value="${product.productId}:${product.presentationChannelText}:${product.programmingType}" disabled="true"/>                                                            
                                                                  </td>
                                                             </c:when>
                                                             <c:otherwise>
                                                                  <td width="1">
                                                                       <html-el:radio property="dishHDProduct" value="${product.productId}:${product.presentationChannelText}:${product.programmingType}"/>                                                            
                                                                  </td>
                                                             </c:otherwise>
                                                        </c:choose>Because I am not able to use JSP 2.0 and therefore must use JSTL 1.0

  • Joining jsp and jstl

    first of all, i'm a newbie..sorry for my beginner question.
    <sql:setDataSource var="datasource" driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost/test"
                       user="root" password="123"/>
    <sql:query var="ts" dataSource="${datasource}">
      SELECT id FROM t1
    </sql:query>
    <c:forEach items="${ts.rows}" var="row">
        <tr>
            <td><c:out value="${row.id}" /><img src=<${row.path}></td>
        </tr>
    </c:forEach>I want to change the above code and give the image source like this:
    <img src=<###CONTEXTPATH###+${row.path}>how can I do that?

    The contextpath is available by HttpServletRequest#getContextPath().
    But you also can define a <base href> with the contextpath in the <head>. This will be applied to all relative links inside the page.

  • JavaServer Pages (JSP) and JSTL

    Hi!
    I need to create a table where the user specifies only the td of the table. I do not know the size that the user will come but if he put 3 columns he needs to create these columns and then write the result
    thanks.

    Hi! I'm sorry
    I just forget to mention the problem,
    I am passing the following information to the TagLib.
    <mytag:table var="varItem" items="collVO">
    <mytag:colum print="Name" itens="${varItem.name}" with="100"></mytag:colum>
    <mytag:colum print="End" itens="${varItem.end}" with="100"></mytag:colum>
    <mytag:colum print="City" itens="${varItem.city}" with="100"></mytag:colum>
    </mytag:table>and I am getting this information again.
    private void getTable() throws JspException
    Object obterCollVoRequest = ExpressionEvaluatorManager.evaluate("collVo", getCollVO(), java.lang.String.class,this.pageContext);
    setCollVO(obterCollVoRequest.toString());
    Collection collectionCollVo = (Collection) pageContext.findAttribute(obterCollVoRequest.toString());
    setCollection(collectionCollVo);     
    }This problem is that he is coming null not know why this error, and I am not aware mounted the table with the above information (Remembering that is dynamic).
    Example:
    <table>
    <tr>
       <td>Nome</td>
       <td>End</td>
       <td>City</td>
    </tr>
    <tr>
       <td>Roger</td>
       <td>Street A Number 22</td>
       <td>New York</td>
    </tr>
    <tr>
       <td>Thomas</td>
       <td>Street Clich Number 199</td>
       <td>New York</td>
    </tr>
    </table>Thank you for your attention!
    Edited by: rdfcp on Oct 28, 2008 9:51 AM

  • Newbie question: JSP x JSTL (Will JSTL kill JSP?)

    Hi,
    I'm newbie in java development and know I'm learning about jsp and jstl.
    I'm reading some articles about jstl, but my doubt remains...
    Was jstl create to kill jsp in apresentation layer?
    Please, if possible, show me an example that I really need use jsp instead of jstl?
    What kind of things can't I do with jstl?
    Thanks a lot

    Ranieri wrote:
    I'm sorry, my question wasn't very clear.
    When I said JSP, I wanted say Scriptlet...
    My central point is that Scriptlet is very confortable for me at the moment...
    So, I don't see a motive to change:
    <% if (1 == 2) }....
    to
    <c:if test="1 eq 2">...Lots of motive to change.
    Now... you can say that jstl is more easy, Or you can say that JSTL is easier.
    but if a big number of people start to use it, it will increase and will turn another programming language...It sounds like you think this is a new thing. JSTL has been around for a very long time. 2001 vintage. It's already here, dude.
    Besides, it's not a programming language per se. There will be other tag libraries, but those are custom. JSTL as written hasn't changed in years. The standard won't expand.
    So, why create another programming language if we have Scriptlet to do the same?Like I said before, scriptlets were the mistake. They're unreadable, ugly, and encourage putting logic in JSPs. Very bad, indeed.
    %

  • 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

  • Programming JSP using JDeveloper 10.1.3 and JSTL

    Hello,
    I new in JDeveloper. I am creating a web proyect and I am programming a JSP. This JSP includes JSTL 1.1 Core, exactly the next line:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    When I compile my proyect, obtain the next error:
    Error: java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
    I ensured that this class (javax.servlet.jsp.tagext.TagAttributeInfo) has no that constructor (String, String, boolean) but when I consult the Sun documentation for that class, it is said that the class contain the constructor.
    My proyect include the next libraries defined in JDeveloper:
    · J2EE
    · JSTL 1.1
    · Strut Runtime
    · JSTL 1.1 tags
    Please, what should I do to do my proyect work?

    Constructor javax.servlet.jsp.tagext.TagAttributeInfo (String, String, boolean)
    is not defined. The JSP 2.0 constructor is
    TagAttributeInfo(java.lang.String name,
    boolean required,
    java.lang.String type,
    boolean reqTime,
    boolean fragment)
    Another constructor is
    TagAttributeInfo(java.lang.String name,
    boolean required,
    java.lang.String type,
    boolean reqTime)

  • JSP 2.0 and JSTL question

    Hi,
    I'd just like to ask if anyone could suggest a good site with tutorias about JSP 2.0 and more specific about requesting and manipulating attributes.
    It is easy to do so by using servlets withn something like:
    ArrayList mylist = (ArrayList)request.getAttribute("mylist");
    and use it with an iterator.
    ...but I'd like to learn how I can request and manipulate ArrayLists in JSP using JSTL.
    thanks in advance,
    mike

    All you should need are the <%@ taglib %> and the jar files in your web-inf/lib directory.
    Nothing is required in web.xml for it to work.
    Make sure you are using the JSTL 1.1 taglib URIs though: http://java.sun.com/jsp/jstl/core.
    They look a lot like the old ones, but include /jsp now as well.
    Does the EL evaluate inside a tag? eg <c:out value="${application.servletContextName}"/>
    Couple of things to try
    EL evaluation may be disabled: Put this at the top of your page:
    <%@ page isELIgnored=false %>
    Check your web.xml for something like this (disables EL in pages)
    <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <el-ignored>true</el-ignored>
    </jsp-property-group>
    What version of the DTD are you using for web.xml? According to the JSP spec, if it is less than 2.3, and you haven't specified handling of the EL, it is ignored.
    Relevant bits of the JSP2.0 spec: JSP3.3.2, JSP 1.10.1
    Can you post some code which isn't working?
    Cheers,
    evnafets

  • How to send object arraylist from servlet to jsp and display using jstl

    Hi All....
    I have a simple application and problem with it.
    Once user logged in to system the user will redirect to LoginServlet.java controller.
    Then in LoginServlet I want to redirect user to another page called book_details.jsp.
    this is my login servlet.
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              PrintWriter out = response.getWriter();
              ArrayList<BankAccountDTO> account_list = new ArrayList();
              ResultSet resultSet = null;
              LowFairAirDB airDB = null;
              try{
                   airDB = new LowFairAirDB();
                   String query = "SELECT account_id, type, description, balance, credit_line, begin_balance, begin_balance_time_stamp FROM bank_account";
                   airDB.sqlSelect(query);
                   resultSet = airDB.getResultSet();
                   while(resultSet.next()){
                        account_list.add(new BankAccountDTO(resultSet.getInt(1),
                                                                     resultSet.getInt(4),
                                                                     resultSet.getInt(5),
                                                                     resultSet.getInt(6),
                                                                     resultSet.getString(2),
                                                                     resultSet.getString(3),
                                                                     resultSet.getString(7)));
              }catch(Exception ex){
              }finally{
                   try{resultSet.close();}catch(Exception ex){}
                   airDB.sqlClose();
         }I set bank account values to BankAccountDTO.java objects and add them to the arrayList.
    Next I want to send this objects arrayList to books_details.jsp and wanna display each objects values using JSTL.
    I still finding a way to go through this.
    1. Can anyone say how can I do it?
    2. Is there any other method to do the same thing without using JSTL?
    thanks in advance,
    Dil.

    Naishe wrote:
    In your servlet,
    request.setAttribute("account_list", account_list);
    requestDispatcher.findForward("/your/display/jsp");
    Good. I would only follow the Java naming conventions. E.g. accountList or accounts instead of the ugly PHP/C conventions.
    In the JSP,
    lst = (List< BankAccountDTO >)request.setAttribute("account_list");
    for(BankAccountDTO b: lst){
    populate your HTML tags or whatever
    Wrong. 1) You need getAttribute() and 2) you should not use scriptlets. Use JSTL c:forEach, e.g.<table>
        <c:forEach items="${accounts}" var="account">
            <tr>
                <td>${account.id}</td>
                <td>${account.type}</td>
                <td>${account.description}</td>
            </tr>
        </c:forEach>
    </table>To the topicstarter: for future JSP/JSTL related questions please use JSP/JSTL forum.
    Here it is: [http://forums.sun.com/forum.jspa?forumID=45].

  • Tomcat 6.0.9 and jsf 1.2 and jstl 1.2 using *.tag file error

    I using :tomcat 6.0.9 and jsf 1.2 and jstl 1.2
    My web.xml is at version 2.5 and I am using a custom tag (with the .tag extension). I am trying to use the http://java.sun.com/jsf/html library and values from my attribute. I'm new to this so I figure I must just me missing something.
    I am run http://192.168.1.1/test.jsf laster,view:
    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: Unable to compile class for JSP:
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:212)
         org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:576)
         org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:50)
         org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:627)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
         org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:631)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:645)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:190)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:414)
         com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:455)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:139)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.9 logs.
    if go to /WEB-INF/tags/test.tag ,delete line: <h:outputText id="test" value="hello!" />
    run http://192.168.1.1/test.jsf is OK!(no error),So I guess error for "<h:outputText id="test" value="hello!" />" line ,why in test.tag file do can't use the "http://java.sun.com/jsf/html " library,please help me.......
    Here is file WEB-INF/web.xml content:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements. See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License. You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    -->
    <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_5.xsd"
    version="2.5">
    <display-name>Welcome to Tomcat</display-name>
    <description>
    Welcome to Tomcat
    </description>
    <!-- Faces Servlet -->
    <servlet>
         <servlet-name>Faces Servlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
         <load-on-startup> 1 </load-on-startup>
    </servlet>
    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    </web-app>
    Here is file /test.jsp code:
    <%@ page contentType="text/html;charset=UTF-8" %>
    <%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <f:view>
    <html>
    <head>
    <title>test</title>
    </head>
    <body>
    <!-- body start -->
    <h:outputText id="myinfo" value="test success" />
    <tags:test/>
    <!-- body end -->
    </body>
    </html>
    </f:view>
    Here is file /WEB-INF/tags/test.tag code:
    <%@tag pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <h:outputText id="test" value="hello!" />
    Thanks for any help.

    Don't know if it's important, but there is no schema avaiable at: http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd
    I found the right one at: http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
    /perty
    Message was edited by:
    perajonsson

  • SQLJ JSP and SERVLETS which Environment?

    Hello,
    I am attempting to run the samples on Chapter 5 of the
    following documents with partial success.
    http://technet.oracle.com/docs/products/oracle8i/doc_library/817_
    doc/java.817/a83726/oraext2.htm
    http://download-west.oracle.com/otndoc/oracle9i/901_doc/java.901/
    a90208/oraext.htm#1015820
    1. Do I need the Apache+Jserv environment to run SQLJ and JSP?
    2. What do I need to do run SQLJ on oc4j if possible?
    3. I dont know how to load(?) and/or run this .sqljsp file.
    <%@ page language="sqlj"
    import="sqlj.runtime.ref.DefaultContext,oracle.sqlj.runtime.Oracl
    e" %>
    <HTML>
    <HEAD> <TITLE> The SQLJQuery JSP </TITLE> </HEAD>
    <BODY BGCOLOR="white">
    <% String empno = request.getParameter("empno");
    if (empno != null) { %>
    <H3> Employee # <%=empno %> Details: </H3>
    <%= runQuery(empno) %>
    <HR><BR>
    <% } %>
    <B>Enter an employee number:</B>
    <FORM METHOD="get">
    <INPUT TYPE="text" NAME="empno" SIZE=10>
    <INPUT TYPE="submit" VALUE="Ask Oracle");
    </FORM>
    </BODY>
    </HTML>
    <%!
    private String runQuery(String empno) throws
    java.sql.SQLException {
    DefaultContext dctx = null;
    String ename = null; double sal = 0.0; String hireDate = null;
    StringBuffer sb = new StringBuffer();
    try {
    dctx = Oracle.getConnection("jdbc:oracle:oci8:@", "scott",
    "tiger");
    #sql [dctx] {
    select ename, sal, TO_CHAR(hiredate,'DD-MON-YYYY')
    INTO :ename, :sal, :hireDate
    FROM scott.emp WHERE UPPER(empno) = UPPER(:empno)
    sb.append("<BLOCKQUOTE><BIG><B><PRE>\n");
    sb.append("Name : " + ename + "\n");
    sb.append("Salary : " + sal + "\n");
    sb.append("Date hired : " + hireDate);
    sb.append("</PRE></B></BIG></BLOCKQUOTE>");
    } catch (java.sql.SQLException e) {
    sb.append("<P> SQL error: <PRE> " + e + " </PRE> </P>\n");
    } finally {
    if (dctx!= null) dctx.close();
    return sb.toString();
    %>
    I named above file as test2.sqljsp then I tried these procedures:
    a) $ ojspc test2.sqljsp --these created all the files
    b) $ loadjava -u -v scott/tiger _test2.class -resolve
    this generated:
    initialization complete
    loading : _test2
    creating : _test2
    resolver :
    resolving: _test2
    errors : _test2
    ORA-29521: referenced name test2$_jsp_StaticText could not
    be found
    ORA-29521: referenced name test2SJProfileKeys could not be
    found loadjava: 2 errors
    c) listed the directory and both these files are there but it
    cannot resolve or find it?
    d) I recall reading something about publishjsp command but I have
    to establish a session shell with OSE? this part is very
    confusing and am not sure what to do here.
    e) not sure if i need to publish the loaded class (create a
    procedure? so it can be known to the rest of plsql?)
    A step by step procedure is very much appreciated. fyi.. I
    have Oracle 8.1.7, + oc4j, I can run sqlj from command line
    and class files generated I can run. I can also run JSP and
    servlets on the oc4j accessing the database. It is this SQLJ
    that throws me off balance. If you include Jdeveloper steps
    ro run SQLJ thats also welcome.
    Thanks in advance for kind responses posted.

    In many Model-View-Controller web applications implemented using J2EE, servlets are as controllers to direct the flow between the model and view. While servlets can output HTML code directly, it is much better to use JSPs for the most part. JSPs contain HTML and possibly Java scriptlets. The J2EE container will typically compile JSPs into servlets. While you could use a JSP as a controller, there are drawbacks to that approach. To minimize the amount of Java code in your JSPs, you can either use the tags provided by the JSP spec or use tag libraries written by someone else or yourself. See the JSTL for one such example.
    Also see:
    http://wiki.java.net/bin/preview/Javapedia/MVC
    http://wiki.java.net/bin/view/Javapedia/JavaServerPages

  • Problem trying to run compile jsp containing JSTL tags

    Hi,
    I am facing a problem regarding compiling jsp containing JSTL tags.
    Can anybody help me out?

    Yes it is giving an error when i try to compile the jsp.
    And it's giving error on the include of the taglib in the jsp as
    C:\dev\ppdev\DOMA\jspcompile\WEB-INF\jstl\c-rt.tld" is an invalid archive file!
    Actually we are not using th default entry for taglib. Instead we have made an entry in the web.xml. Like this
    <taglib>
    <taglib-uri>/WEB-INF/c.tld</taglib-uri>
    <taglib-location>/WEB-INF/jstl/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/c-rt.tld</taglib-uri>
    <taglib-location>/WEB-INF/jstl/c-rt.tld</taglib-location>
    </taglib>
    And using this uri in the jsp page like this
    <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
    <%@ taglib uri="/WEB-INF/c-rt.tld" prefix="c_rt" %>
    And when we try to compie the jsp its giving the error.
    C:\dev\ppdev\DOMA\jspcompile\WEB-INF\jstl\c-rt.tld" is an invalid archive file!
    I would appreciate your help and update me if any more information is required.

  • Pass ArrayList to jsp and display first index of resultset?

    Is it possible for me to pass an ArrayList to a jsp, and display the each resultset stored in the ArrayList by the ArrayList index?
    The code below gets passed two paramaters. An invorg, and item. It then creates resultset based upon the Object and puts the results into an ArrayList.
    The resultset returned varies, but the largest resultset that I have received back has not been bigger thatn 10 resultset rows, and the largest number of columns has been 27 columns.
    I would then like to pass the whole ArrayList to the jsp and display the contents for each row based on the index it is on.
    Is this possible?
    public class RunReportAction extends MTDAction
        ArrayList results;   
        public RunReportAction()
        public boolean execute(HttpServletRequest _req, HttpServletResponse _res) throws ServletException, IOException
            String item = _req.getParameter("itemsToAdd");
            String invorg = _req.getParameter("invorg");
            try
                if (rep_type.equals("Vendor"))
                    runVendorReport(item, invorg);
                else if (rep_type.equals("Purchase Order"))
                    runPOReport(item, invorg);
                else if (rep_type.equals("Inventory"))
                    runInventoryReport(item, invorg);
                else if (rep_type.equals("Item Usage"))
                    runWhereUsedReport(item, invorg);
                else if (rep_type.equals("Cost/Purchasing"))
                    runCostReport(item, invorg);
                else if (rep_type.equals("Planning"))
                    runPlanningReport(item, invorg);
            catch (Exception e)
                setView("SSMErrorPage.jsp");
                model = e;
            model = results;
            view = "SSM_Reports";
            return true;
        boolean runInventoryReport(String item, String invorg) throws MTDException
            try
                CallableStatement cs = conn.prepareCall("{call CTI_SSM_PKG.get_inventory_report(?,?,?)}");
                cs.registerOutParameter(3, OracleTypes.CURSOR);
                cs.setObject(2, item, Types.VARCHAR);
                cs.setObject(1, invorg, Types.VARCHAR);
                cs.execute();
                ResultSet rs = (ResultSet)cs.getObject(3);
                while (rs.next())
                    InventoryObj inventory = new InventoryObj();
                    inventory.setInvOrg(rs.getString(1));
                    inventory.setItem(rs.getString(2));
                    inventory.setItemDescription(rs.getString(3));
                    inventory.setInvFlag(rs.getString(4));
                    inventory.setStockEnabled(rs.getString(5));
                    inventory.setTransactable(rs.getString(6));
                    inventory.setRevQtyControl(rs.getString(7));
                    inventory.setReservable(rs.getString(8));
                    inventory.setCheckShortage(rs.getString(9));
                    inventory.setLotControl(rs.getString(10));
                    inventory.setShelfLife(rs.getString(11));
                    inventory.setLotStartPrefix(rs.getString(12));
                    inventory.setLotStartNumber(rs.getString(13));
                    inventory.setLotCycleCount(rs.getString(14));
                    inventory.setPosMeasureError(rs.getString(15));
                    inventory.setNegMeasureError(rs.getString(16));
                    inventory.setSerialGeneration(rs.getString(17));
                    inventory.setSerialNumbStart(rs.getString(18));
                    inventory.setSerialPrefixStart(rs.getString(19));
                    inventory.setLotStatus(rs.getString(20));
                    inventory.setSerialStatus(rs.getString(21));
                    inventory.setLotSplit(rs.getString(22));
                    inventory.setLotMerge(rs.getString(23));
                    inventory.setLocatorControl(rs.getString(24));
                    inventory.setToday(rs.getString(25));               
                    results.add(inventory); 
                    System.out.println(results);
            catch (SQLException e)
                throw (new MTDException("Failed to run report in database.", e));
            //model = results;
            //setView("SSM_Reports.jsp");
            return true;
    }jsp code:<%@ page import="java.util.*"%>
    <%@ page import="ssmmtd2.InventoryObj"%>
    <html>
    <head>
    <title> SSM 2 Inventory Report </title>
    <style>
              A {text-decoration:none;color:black;}
              A:Hover {color:Blue}
    </style>
    </head>
    <%
      ArrayList inventory;
      if (request.getAttribute("model") != null)
        if ((request.getAttribute("model").getClass().getName()).equals("java.util.ArrayList"))
          inventory = (ArrayList)request.getAttribute("model");     
          if (inventory != null && inventory.size() > 0)
          %>
        <body  bgcolor="#FFFFFF">
          <table border = "1" width="755" cellpadding="0" cellspacing = "0">
          <tr>
            <td colspan="3" width="755" align="center">
              <p align="center"><big><b><font color="#000080">Inventory Report</font></b></big>
            </td>
          </tr>
          </table>
          <table border="1" width="755">
            <tr>
              <td width="100%">
                <form>
                  <table>
                <%
                  Iterator i = inventory.iterator();
                  while (i.hasNext())
                    InventoryObj invObj = (InventoryObj)i.next();
                %>
                  <TR>
                    <TD><B>ITEM:</B>
                      <align="left" valign="center"><%=invObj.getItem()%>
                    <td><B>DESCRIPTION:</B>
                      <align="left" valign="center"><%=invObj.getItemDescription()%>
                  <TR>
                  </TR>
                  <TR>
                  </TR>
                  <TR>
                  </TR>
                    <td><B>ORGANIZATION:</B>
                      <align="left" valign="center"><%=invObj.getInvOrg()%>
                    </TD>
                    <TD>
                      <B>CURRENT DATE:</B>
                        <align="left" valign="center"><%=invObj.getToday()%></TD>
                    </TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                    <TR>
                      <TD><B>INVENTORY ITEM</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getInvFlag()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>STOCK ENABLED</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getStockEnabled()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>TRANSACTABLE</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getTransactable()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>REVISION QTY CONTROL</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getRevQtyControl()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>RESERVABLE TYPE</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getReservable()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>CHECK SHORTAGES</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getCheckShortage()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>LOT CONTROL</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotControl()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>SHELF LIFE DAYS</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getShelfLife()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>STARTING LOT PREFIX</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotStartPrefix()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>STARTING LOT NUMBER</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotStartNumber()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>CYCLE COUNT</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotCycleCount()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>POSITIVE MEASUREMENT ERROR</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getPosMeasureError()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>NEGATIVE MEASUREMENT ERROR</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getNegMeasureError()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>SERIAL GENERATION</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialGeneration()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>STARTING SERIAL NUMBER</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialNumbStart()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>STARTING SERIAL PREFIX</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialPrefixStart()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>LOT STATUS</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotStatus()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>SERIAL STATUS</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialStatus()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>LOT SPLIT</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotSplit()%>
                      </TD></TR>
                    <TR>
                      <TD><B>LOT MERGE</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotMerge()%>
                      </TD>
                    </TR>
                    <TR>
                      <TD><B>LOCATOR CONTROL</B>
                      <TD align="left" valign="center"><b>:</B>  <%=invObj.getLocatorControl()%>
                      </TD>
                    </TR>
                <%} %>
                  </table>
                <input type="hidden" name="SearchValue">
                <BR>
                <img src="images/close11.bmp" style="cuinvObjor:hand" onmouseover='this.src="images/close12.bmp"' onmouseout='this.src="images/close11.bmp"' onClick="window.close()">     
                <img src="images/print1.bmp" style="cuinvObjor:hand" onmouseover='this.src="images/print2.bmp"' onmouseout='this.src="images/print1.bmp"' onClick='this.src="images/print3.bmp"; window.print()' >
                </form>
              </td>
            </tr>
          </table>
        </body>
    <%
    %>
    </html>

    Your arraylist object should be a list of inventory bean objects and then, If you are using struts, you could use logic:iterate tags.. or something equivalent.. you could use forEach in jstl..

  • JSP and SQL Queries

    Hello,
    If a JSP application needs Database connectivity to display some values, what is the best approch for the same.
    1. Using SQL connections with resultset
    2. Using Java Class and using the same in JSP.
    3. any other??
    what is the industry standard for the same.
    Thnx,,
    Girish

    JSP's are used to display a view (such as a user interface or a report). Database connectivity is business logic and you don't do business logic in JSP's. I would create a servlet to handle business logic and then put the database logic in seperate classes that you can call from the servlet. Then use a JSP with JSTL to display the results of the database query. Putting the business logic in seperate classes makes it reusable.
    Frameworks such as Struts, Spring, JSF, etc. work in similar ways, so I guess you can call it an "industry standard". In software development there is no such thing however, you develop to solve a problem, not to follow standards.
    If you want to do it this way I suggest you lookup these two things:
    1) how to make servlets and JSP's work together
    2) the Model View Controller pattern

Maybe you are looking for

  • Unique ID's in java - interessting theoretical problem

    Hey all, I'm am trying to generate completely unique id's in java. These ID's should be provable unique within different processes and different systems. The machines IP address should not be assumed unique because, for example, two machine in a diff

  • Ideal Set-up, Could it Work?

    I have a Sony Vaio Laptop, a iPhone4, and a Sony Bravia TV. I'm thinking about getting a Sony Blu-ray player. I recently have been weighing the idea of buying all my movies off iTunes. However, I want to be able to play them on my TV with having to s

  • EA4500 Firmware Ver: 2.1.38.138880 fails to install

    I have tried twice to upgrade my Firmware from Ver: 2.1.38.138827 to Ver: 2.1.38.138880  Both attempts have failed (Let them sit for over 10 Mins with the Flashing Cisco Logo).  To get my router back to a usable state (I found an unbrick thread on an

  • Excel export on disco viewer10.1.2 without colors

    Hello, When I export a report to Excel on discoverer viewer it doesn't display colors. With plus everything seams to be ok. Thanks for your help, Best regards, Max

  • BC4J Application

    Hi all, We develope an appliction accesing about 30 tables and we wnt to use the BC4J. Is it possible to split the business components into several packages and use the more than one resulting Application Module on a form without creating more than o