Servlet/JSP question

Hello guys I have just been reading the HeadFirst Servlet/JSP book from O'REILLY.
I have used it as a workbook just to see how the framework are use. After ending this book I have planned to do some stuff by my self. I'm precisely in the last chapters of the book right now so I thought about headed toward the Servlet/JSP API. Well in there I found out that the information about JSP were all just about stuff which concerned the Container. I didn't find anything about the syntax used in JSP, the EL syntax nor how the JSTL 1.1 tags looks like! And there where nothing about the DD.
So I'm wondering were I could fins this information, and why they aren't reserved in the JSP API?
Another question, when was the JSP2.0/Servlet2.4 specification released?

Which edition of the book were you reading? It should have covered EL and JSP syntax right?
Servlet2.4/JSP2.0 has been around for at least 5 years. Can't remember the exact date, but the specification was finalised November 2003.
The JSP API is from the programming perspective. Tag library documentation is seperate.
Useful links for you:
[JSP reference |http://java.sun.com/products/jsp/docs.html] - JSP tags and EL.
[JSTL Apis|http://java.sun.com/products/jsp/jstl/reference/api/index.html] THE reference for JSTL. Don't be afraid of the JSTL specifications. They are quite readable, and document all the JSTL tags fully. I refer to them constantly.
Cheers,
evnafets

Similar Messages

  • Newbie JSP/Servlet general question

    Hi,
    I am currently studying the life cycle of a JSP page from the Java EE 5 Tutorial (http://java.sun.com/javaee/5/docs/tutorial/doc/bnahe.html). This document says that: "+If an instance of the JSP page’s servlet does not exist, the container loads the JSP page’s servlet class, instantiates an instance of the servlet class, initializes the servlet instance by calling the jspInit method+".
    My two questions are:
    i) Does this JSP servlet implement the HttpJspPage interface defined in javax.servlet.jsp?
    ii) Does Struts and Spring MVC provide such JSP servlet Java classes implementations or are these part of other packages? If not, which packages offer such implementations?
    Thanks,
    J.

    Jrm wrote:
    Hi,
    I am currently studying the life cycle of a JSP page from the Java EE 5 Tutorial (http://java.sun.com/javaee/5/docs/tutorial/doc/bnahe.html). This document says that: "+If an instance of the JSP page’s servlet does not exist, the container loads the JSP page’s servlet class, instantiates an instance of the servlet class, initializes the servlet instance by calling the jspInit method+".
    My two questions are:
    i) Does this JSP servlet implement the HttpJspPage interface defined in javax.servlet.jsp?Yes.
    >
    ii) Does Struts and Spring MVC provide such JSP servlet Java classes implementations or are these part of other packages? If not, which packages offer such implementations?No, the implementation for the JSP servlet is usually provided by the Servlet Container, not a framework, since the Servlet Container is responsible for creating and compiling the JSP.
    >
    Thanks,
    J.

  • Class not found javax.servlet.jsp.jstl.sql.Result in Richfaces

    When I try to run the richfaces application using Weblogic 10.3 AS and Netbean IDE 6.9.1, I found ClassNotFoundException on javax.servlet.jsp.jstl.sql.Result class.
    I class path the following libs.
    commons-beanutils-core-1.8.0.jar
    commons-digester-1.8.jar
    commons-fileupload-1.2.1.jar
    commons-io-1.2.jar
    commons-logging-1.1.1.jar
    glassfish.el_2.1.1.jar
    glassfish.jsf_1.2.9.0.jar
    javassist-3.8.0.GA.jar
    jhighlight-1.0.jar
    jsf-facelets.jar
    jsf-api.jar
    log4j-1.2.14.jar
    richfaces-api-3.3.0.GA.jar
    richfaces-impl-3.3.0.GA.jar
    richfaces-ui-3.3.0.GA.jar
    glassfish.jstl_1.2.0.1.jar
    Also I try to deploy without using some jar files already exists in application server.
    My web.xml configuration is-
    <context-param>
    <param-name>org.richfaces.SKIN</param-name>
    <param-value>#{skinSelector.skin}</param-value>
    </context-param>
    <context-param>
    <param-name>org.richfaces.CONTROL_SKINNING</param-name>
    <param-value>enable</param-value>
    </context-param>
    <context-param>
    <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    </context-param>
    <context-param>
    <param-name>org.ajax4jsf.SKIN</param-name>
    <param-value>skin_name</param-value>
    </context-param>
    <filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <login-config>
    <auth-method>BASIC</auth-method>
    </login-config>
    <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    I also try to configure <library-ref>....</libray-ref> configuration in weblogic.xml and weblogic-application.xml and I also deploy JSF-2.0.war as library in application.
    Please
    h5.MUTU

    So why didn't you think that the JSP forum here wasn't a good place to ask JSP questions like this one?
    You can use <c:for-each> with a List. That's how it's designed. I don't understand why you say you can't. Perhaps you were confused by the SQL tags in JSTL. But anyway, you should just return a List from your EJB and forget about using obscure internal JSP classes.

  • "javax.servlet.jsp.JspException: null" When trying to use JSTL

    Hello,
    I am trying to use some taglibs from Apache but I am getting the following error when trying to access the relevant page:
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: null
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         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
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: null
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         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)
         org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         org.apache.jsp.Questions_jsp._jspService(Questions_jsp.java:42)
         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:332)
         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: javax.servlet.jsp.JspException: null
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.WEB_002dINF.EL_005f2_jsp._jspService(EL_005f2_jsp.java:171)
         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:332)
         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)
         org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         org.apache.jsp.Questions_jsp._jspService(Questions_jsp.java:42)
         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:332)
         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
    java.lang.reflect.InvocationTargetException
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(Unknown Source)
         org.apache.jsp.WEB_002dINF.EL_005f2_jsp._jspx_meth_c_set_0(EL_005f2_jsp.java:208)
         org.apache.jsp.WEB_002dINF.EL_005f2_jsp._jspService(EL_005f2_jsp.java:113)
         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:332)
         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)
         org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         org.apache.jsp.Questions_jsp._jspService(Questions_jsp.java:42)
         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:332)
         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)My web.xml file is as follows:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
    version="2.4">
    <display-name>Jsp_Ex09 - JSP Standard Tag Library</display-name>
    <welcome-file-list>
    <welcome-file>welcome.jsp</welcome-file>
    </welcome-file-list>
    <jsp-config>
    <taglib>
    <taglib-uri>/simplequestions</taglib-uri>
    <taglib-location>/WEB-INF/tlds/simplefaq.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>
    </taglib>
    <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <el-ignored>false</el-ignored>
    <scripting-invalid>true</scripting-invalid>
    </jsp-property-group>
    </jsp-config>
    </web-app>I have the standard and jstl jars in my lib directory and the relevant tlds files int the tlds directory. I am using Tomcat 5.5 and J2EE 5.
    The jsp in question is as follows:
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    <html>
    <head>
    <title>JSTL Q2</title>
    </head>
    <body>
    <h1>JSTL Question 2</h1>
    <h2>How do I use the JSTL?</h2>
    <jsp:useBean id="questions" class="com.apress.faq.Questions"
    scope="page">
    <jsp:setProperty name="questions" property="topic" value="EL"/>
    </jsp:useBean>
    <table border="1">
    <!-- the literal JSTL tag will be in left column of table -->
    <!-- the evaluated JSTL tag will be in right column of table -->
    <tr><th>tag</th><th>result</th></tr>
    <!-- this tag uses c:out to send the value of an EL to the response -->
    <tr><td><c:out value="${'${'}questions.topic}"/></td>
    <td><c:out value="${questions.topic}"/></td>
    </tr>
    <!-- this tag uses c:set to set the property of a JavaBean -->
    <c:set target="${questions}" property="topic" value="JSTL" />
    <tr>
    <td><c:set target="${'${'}questions}" property="topic"
    value="JSTL"/>
    </td>
    <td><c:out value="${questions.topic}"/></td>
    </tr>
    <!-- this tag uses c:if to determine whether to create another row -->
    <c:if test="${questions.topic == 'EL'}">
    <tr><td>This row will not be created</td>
    <td></td>
    </tr>
    </c:if>
    <c:if test="${questions.topic == 'JSTL'}">
    <tr><td>This row was created because the c:if tag result was true</td>
    <td></td>
    </tr>
    </c:if>
    </table>
    <h2>Multiplication table, 1 - 5</h2>
    <!-use the forEach tag to create a table -->
    <table border="1">
    <tr><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr>
    <c:forEach var="i" begin="1" end="5">
    <tr><td><c:out value="${i}"/></td>
    <c:forEach var="j" begin="1" end="5">
    <td><c:out value="${i*j}"/></td>
    </c:forEach>
    </tr>
    </c:forEach>
    </table>
    <h2>Formatting numbers</h2
    <br><fmt:formatNumber value="23.456" type="number" /> results in
    <fmt:formatNumber value="23.456" type="number" />
    <br><fmt:formatNumber type="currency">23.456
    </fmt:formatNumber> results in <fmt:formatNumber
    type="currency">23.456</fmt:formatNumber>
    <br><fmt:formatNumber value=".23456" type="percent"/> results
    in <fmt:formatNumber value=".23456" type="percent"/>
    <br><fmt:formatNumber value=".23456" type="percent"
    minFractionDigits="2"/> results in <fmt:formatNumber
    value=".23456" type="percent" minFractionDigits="2"/>
    </body>
    </html>Can anyone spot the problem?
    Sorry for such a big post!

    ava.lang.reflect.InvocationTargetException
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(Unknown Source)From the stacktrace, it appears to be from a <c:set> tag.
    Invocation target exception would meant that an error was encountered calling the setter.
    That would focus on this part of the code:
    <!-- this tag uses c:set to set the property of a JavaBean -->
    <c:set target="${questions}" property="topic" value="JSTL" />
    <tr>
    <td><c:set target="${'${'}questions}" property="topic"
    value="JSTL"/>
    </td>That nesting of ${ } inside ${} looks dodgy to me. What is it you are trying to achieve?

  • How to solve javax.servlet.jsp.JspException: duplicate Id for a component?

    Dear everyone,
    I have built some customized JSF components. In the taglib, there is attribute "id" for my components. There is no problem when the page is run, but when I click submit button, there are errors.
    javax.servlet.jsp.JspException: duplicate Id for a component form1:dojoComboBox1     at com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:191)     at _andychun._jspService(_andychun.java:190)     [andychun.jsp]     at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.1) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:598)     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:522)
    Please kindly help solve this problem. Thank you.
    Best Regards,
    David

    Alex,
    my guess is that because you copied content from the
    first page to the next, you created JSF components
    with the same ID. JSF components must have unique IDs
    though.
    FrankHello Frank,
    Thanks for your reply. The thing is in the first page I do not have much id's specified/defined. And in the second page what I did was to take out all id's to see if it was conflicting. When I tried it again I still got the error. So the id's are being generated automatically if seems.
    Also is it that JSF components should have unique id's for a particular page or all pages in the JSF application?
    Any other sugguestions. I hope you understand what I am saying. If you have any questions or uncertainties fell free to ask me.
    Thanks,
    Alex.

  • Abstract portal component and JSP question

    Can we use htmlb components in abstractportal components.
    I am using isolatedhtmlcontainer in abstractportal component and it is not compiling. It works fine with Dynpage component
    Also one more question can we just write a JSP to get the userid of the portal. I tried typecasting request object to IPortalComponentRequest , but iam not able to get the userid . Can anyone suggest anything . I want get the userid from the jsp and pass this userid to asp as query string
    Thanks
    LAK

    Yes you can create a JSPDynPage and define the component type as NativeJSP in portalapp.xml for e.g.
      <i>      <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/YourJSP.jsp"/></i>
    The explicit object for IPortalComponentRequest is componentRequest in JSP. The other way to get componentRequest is
    IPortalComponentRequest       currentRequest       = (IPortalComponentRequest) pageContext.getAttribute(javax.servlet.jsp.PageContext.REQUEST );
    to get the user further just call currentRequest.getUser()

  • Why do we use both servlets & jsps in developing  an application ?

    why do we use both servlets & jsps in developing an application & not only jsps

    Hi,
    It's a pure question of design : Some like it jsp to jsp and others servlet to jsp. It's up to you to decide and it depends of the complexity of your application.
    But the best design is the MVC (servlet and jsp working together) because it helps you separate presentation from logic. It also helps you better maintain you code.
    You can have more info in javaworld.com.
    Good luck
    touco

  • Javax.servlet.jsp.JspException: ObjectPersisterException thrown when loading pipeline

    avax.servlet.jsp.JspException: ObjectPersisterException thrown when loading pipeline due to: An error occurred when attempting to read the object from the database due to: An error occured when attempting to read object from table 'PIPELINE_SESSION' with id 'e7436af5851b0b4b3214b5f26f762a19' due to: com.humana.rightsource.beans.order.StatusIcon
    This happened when trying to load https://www.rightsourcerx.com/. Support at ttps://www.rightsourcerx.com/ informed me that a change had been made to there web site to make access from smart phones easier.

    I can load the page https://www.rightsourcerx.com/
    I am not sure this is a question within the scope of this forum.
    If you have problems with a web page because of the page design or changes to the webpage it is normally up to the website to sort that out.
    You could consider posting on a mozillazine forum to see what they say if you think it is a website problem.
    * http://forums.mozillazine.org/viewforum.php?f=25
    If the problem is with Firefox but not with other browsers see
    * [[Firefox can't load websites but other browsers can]]

  • Servlets , JSP, JSTL ,etc

    Hello
    In my Web project , I have used servlets, JSP , JSTL and JDBC to develop a Website, and now I am preparing a report about it.
    Please forgive me if this question sounds "not very smart" , but kindly help. Is it correct to mention in my report I have used J2EE techologies and then briefly explain about JSP, Servlets, etc?
    Thank you
    Vajra

    Well this really depends on what purpose your report serves and what the person/organization you're submitting your report to requires.
    What have you been told to do? Do you have any template that you need to follow?
    If you don't have any, then I guess you could add a section on the technology used and add a brief description covering this.
    But really, this totally depends on your situation and requirements. No one can tell you what to do. And you wouldn't blindly follow advice given by anonymous strangers on an Internet forum for an important project report now would you? :D

  • Why all classes in javax.servlet.jsp are abstract?

    Hi all,
    I have two questions about how the package was designed:
    1.) why all the classes in the javax.servlet.jsp are abstract? what is the benefits?
    2.) why almost all the methods in the class, such as jspWriter, are abstract too? And we can use these abstract methods in the way we use "concrete" methods?
    3.) the same thing for HTTPServlet class at javax.servlet package.
    Thanks in advance
    yllx

    Thanks for the message. In fact, you don't need to reply to the message if you don't have the answer.
    I suspect that this has something to do with the abstract factor design pattern. It allows each container engine to implement the detail based on its own specification. I just need some body to put more details on that.
    Since this happens quite often if the J2EE library, it's good for us to understand why they do this way, and how we can use it in our design.
    yylx

  • Best IDE for developing Applets,Servlets,JSP

    Hi,
    I'm looking for a little bit of advise. I have been developing prototypes using Apache Tomcat. Now I need to go into a full development phase, and I need an IDE to help speedup my work, especially when it comes to debugging applets and servlets. So the following are my questions:
    1. What is the best IDE to use in conjunction with Apache Tomcat? Does JBuilder, for example, fit this bill?
    2. Outside of Apache, I believe there is for example IBM's Websphere, which includes an IDE and a Servlet/JSP container. Which is the best of these packages?
    Thank you for your help.
    Miguel

    Check out NetBeans 3.5 at www.netbeans.org

  • Hosting a Servlet-JSP application onto Portal

    Hi,
    I have a scenario where I need to host a pure Servlet-JSP based application onto portal.
    This application is not developed using Web Dynpro. It is a pure java based application having two separate URLs for Dev and for Production.
    Now I want to give access point to this application via SAP Portal. How can I achieve it?
    Thanks and regards,
    Amey Mogare

    Thank you for reply Michael.
    Actually, this TestApp is already deployed on its Dev as well as Prod server as ear file. So we can use same ear file? If yes, then how? If not, then how do I go about?
    But I have one question here. How will we manage the different URLs of this application on portal?
    I mean, how would Production portal will know to point to production URL of this application???
    Thanks and regards,
    Amey Mogare
    Edited by: Amey Mogare on May 22, 2009 8:29 AM

  • Servlet - JSP design and performance (Tomcat)

    Hi everybody.
    I'm new in Tomcat and servlet/JSP development.
    My current design involves only one servlet (does the business logic, JSP page selections) which delegates the requests to several JSP-s (the JSP-s are included with the "jsp:include" tag).
    The questions:
    1. Has this design some performance drawbacks in contrast with a design in which several servlets are used (some of the included JSP pages will be the same)?
    2. How Tomcat resolves concurent requests (if the same servlet is involved or two separate servlets are involved)?
    Any response is greatly appreciated.
    Thanks.

    A few things to keep in mind:
    Every JSP is really a Servlet. Behind the scenes, these are compiled into Servlets which are then run. So, you really do have an implementation with more than one Servlet.
    Controller Servlet's (one per JVM) are a very popular architecture choice. Struts, Spring and a number of other frameworks use this model. There should not be a difference between running multiple versus a single Servlet, and even if there is, your application undoubtedly has scaling bottlenecks other than this (probably orders of magnitude higher) than worrying about this particular issue.
    Tomcat dispatches the request to whatever Servlet satisfies the servlet-mapping that the URL matches. Since Servlet's are designed to be written thread-safe, and since the container will manage those instances, do not worry.- Saish

  • Javax.servlet.jsp.jstl.sql.Result and arraylist

    Hi,
    I try to explain my problem, I have posted in another section of forum, but perhaps this is a better place:
    I'm trying to use MVC model, so I call an EJB from a servlet which returns me a javax.servlet.jsp.jstl.sql.Result object (this derive from a resultset of a query) and then I make this available to a jsp page.
    I've choosen to return an javax.servlet.jsp.jstl.sql.Result object because I'd like to use this syntax:
    <c:forEach var="profiloString" items="${listaProfili}" >
              ${profiloString.anything}
    </c:forEach>Now I need to put my listaProfili object in session and permit users of my application to add and delete items from it. Finally I will update my database with the new data from listaProfili object.
    If listaProfili is an arraylist I can easily add or delete item from it, but if it is a javax.servlet.jsp.jstl.sql.Result I don't know how I can do this.
    If I return an arraylist object instead of an javax.servlet.jsp.jstl.sql.Result object, I can't use "<c:forEach ..." syntax.
    Can anyone help me?
    Thanks.

    So why didn't you think that the JSP forum here wasn't a good place to ask JSP questions like this one?
    You can use <c:for-each> with a List. That's how it's designed. I don't understand why you say you can't. Perhaps you were confused by the SQL tags in JSTL. But anyway, you should just return a List from your EJB and forget about using obscure internal JSP classes.

  • How to -only- invoke a Servlet/JSP

    Hi,
    I would like to invoke a Servlet or JSP inside a standalone application WITHOUT opening a stream. When I use url.openConnection() or con.connect() the servlet/JSP is not executed, I must also do "ObjectInputStream o = new ObjectInputStream(con.getInputStream());" in order to get the servlet/jsp executed.
    I just want to invoke the servlet/JSP, because I use the returned data for nothing.
    Thanks

    If you openConnection, you might also have to get the output stream from the servlet to make it work properly. (Otherwise, the server, or proxies in-between, might consider that the client has decided it doesn't want the page after all, and may stop requesting it.)
    A cheap way to request a page but get less data back would be..
    conn.setRequestMethod("HEAD");HEAD is exactly like GET, except it doesn't return the body (just the headers, hence the name.) Not entirely sure if it works on Java.
    Failing that, you should be able to just open the input stream, and close it again straight away.

Maybe you are looking for