Performance testing of servlets / beans / jsp ?

Hi. I'd like to performance test my applications, anyone have a clue on what software to use?
I use Fort� for Java CE 3 as the IDE and TomCat 3.23 as the servlet / jsp container.
Hopefully there are some opensource tools to use for this?
Regards,
Chris

You can precompile JSP's, this removes the small hickup when they are requested the first time (making the server translate and compile them). Check the documentation of your specific web/application server on how to do this.
Otherwise:
- buy better hardware
- use a better application server
- make sure your network is properly configured (so packets don't get routed around the network four times before they reach their destination for example)
- make sure your program logic doesn't create bottlenecks such as
unnecessary HTTP requests, redundant loops, etc.
- optimize your database access, use connection pooling
- optimize your database queries. Create indexes, make sure the SQL queries themselves aren't doing unnecessary trips around the database, etc.

Similar Messages

  • JSP- Servlet-- Bean-- JSP how to implement

    I have problem.
    My JSP will take a emplyee id .
    Now I want to show all the values regarding that employee in a JSP(JSP form) from the DB(Oracle).
    So Iam planning like
    JSP-->Servlet-->Bean-->JSP
    So my doubts are.
    1. Is it correct approach
    2.If it is correct then which part of the flow connects to DB and stores the value before putting to JSP.
    Iam using Tomcat 4.31
    Plz help me

    I have problem.
    My JSP will take a emplyee id .
    Now I want to show all the values regarding that
    employee in a JSP(JSP form) from the DB(Oracle).
    So Iam planning like
    JSP-->Servlet-->Bean-->JSP
    So my doubts are.
    1. Is it correct approach
    2.If it is correct then which part of the flow
    connects to DB and stores the value before putting to
    JSP.
    Iam using Tomcat 4.31
    Plz help meHI
    What you are probably proposing is an MVC design pattern. I wonder if u have heard of the struts framework. Sruts uses MVC design pattern wherein the servlet u are talking about acts as a controller(C) and the bean acts as the model(M) .The JSPs present the view(V). Hence the name MVC.
    Your approach is right. First get the employee ID from the jsp and get the corresponding data from database(This logic u implement in the servlet). Then save the fetched data in a bean so that the result jsp can fetch data from it.
    Now this is not a strict MVC approach.
    Learn more about struts. It presents a much more cleaner solution.

  • Unit Testing of servlets and jsp by Junit

    hi,
    suggest me how to do the unit testing by junit!
    thanks in advance

    Or abstract the business logic away from the actual servlets themselves (always a good idea) and test those classes outside the context of a servlet framework.
    That limits the code that actually is impacted by being a servlet to the absolute minimum (essentially parameter passing).

  • Performance testing of servlet.

    Hi
    I am having a Java servlet which is called on click of a submit button.
    Now I wish to check its performance output.
    I am looking to click that submit button multiple times on 1 click !!
    i.e. I wish to simulate an environment where 100 users at same instance of time click that submit button.
    How can I achieve this.
    Thanks

    money321 wrote:
    I am having a Java servlet which is called on click of a submit button.
    Now I wish to check its performance output.What performance? There are a few:
    . How fast does it run?
    . How fast is your connection?
    . End-to-end performance (which may be affected by other things, like database connections).
    I've probably missed some others, but you do need to be sure what it is you're trying to benchmark.
    Winston

  • Javax.servlet.jsp.JspTagException: IterationTag exception when performance test

              hi all:
              i am working with weblogic510 , service pack10. i deploy my
              application as war file and all seems ok but in my performance
              test , there's error as following:
              26 20:30:34 GMT+08:00 2001:<E> <WebAppServletContext-AGENT> Root cause of ServletException
              javax.servlet.jsp.JspTagException: IterationTag: ???????
              at java.lang.Throwable.fillInStackTrace(Native Method)
              at java.lang.Throwable.fillInStackTrace(Compiled Code)
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at javax.servlet.jsp.JspException.<init>(Compiled Code)
              at javax.servlet.jsp.JspTagException.<init>(Compiled Code)
              at com.cnc.model.account.tag.IterationTag.doAfterBody(Compiled Code)
              at jsp_servlet._client.__agentListSearch._jspService(Compiled Code)
              at weblogic.servlet.jsp.JspBase.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled
              Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled
              Code)
              at weblogic.servlet.internal.ServletContextManager.invokeServlet(Compiled
              Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.kernel.ExecuteThread.run(Compiled Code)
              when i test with several current users , it's ok . but when i
              increase users to forty or fifty, the above exception occurs ,
              so some of the users fails , but others can go on successfully.
              i am rather confused.
              any help is appreciated!
              thanks in advance
              daniel
              

    so i have specified no_of_books somewhere instead of getNo_Of_Books();
    the program the error points to is:
    public class ShoppingCartItem
    RetailPriceItem item;
    BigDecimal no_of_books;
    BigDecimal price;
    public ShoppingCartItem()
    public ShoppingCartItem(RetailPriceItem item, BigDecimal no_of_books, BigDecimal price)
    this.item = item;
    this.no_of_books = no_of_books;
    this.price = price;
    public void setItem(RetailPriceItem item)
    this.item = item;
    public void setNo_Of_Books(BigDecimal no_of_books)
    this.no_of_books=no_of_books;
    public void setPrice(BigDecimal price)
    this.price=price;
    public RetailPriceItem getItem()
    return item;
    public BigDecimal getNo_Of_Books()
    return no_of_books;
    public BigDecimal getPrice()
    return price;
    }

  • How do I lookup an EJB 3.0 Session bean from servlet or JSP?

    Does anyone knows how can I invoke an EJB from a servlet or JSP ?
    I deployed a simple EJB on a Oracle Application Server 10g release 10.1.3 and I'm working with JDeveloper 10.1.3. I deployed the files via JDeveloper, and I didn´t specify any orion-ejb-jar.xml or ejb-jar.xml file
    After deployment, the orion-ejb-jar.xml look like this in the server:
    <?xml version="1.0" encoding="utf-8"?>
    <orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd" deployment-version="10.1.3.0.0" deployment-time="10b49516c8f" schema-major-version="10" schema-minor-version="0" >
    <enterprise-beans>
    <session-deployment name="HolaMundoEJB" location="HolaMundoEJB" local-location="HolaMundoEJB_HolaMundoEJBLocal" local-wrapper-name="HolaMundoEJBLocal_StatelessSessionBeanWrapper6" remote-wrapper-name="HolaMundoEJB_StatelessSessionBeanWrapper7" persistence-filename="HolaMundoEJB.home_default_group_1">
    </session-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping name="<default-ejb-caller-role>" impliesAll="true" />
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>
    I'm trying to invoke the ejb in a servlet by doing the following:
    public void doGet(HttpServletRequest request, ....
    Context context = new InitialContext();
    HolaMundoEJB helloWorld =
    (HolaMundoEJB)context.lookup("java:com/env/ejb/HolaMundoEJB");
    String respuesta = helloWorld.sayHello("David");
    When i invoke the servlet I catch a NamingException whose message says something
    like this ....java:com/env/ejb/HolaMundoEJB not found in webLlamaEJB
    I tried different paths for the lookup but nothing....
    Can anyone help me with this topic? Thank you.

    Please try the following code:
    HelloEJBBean.java:
    @Stateless(name="Hello")
    @Remote(value={Hello.class})
    public class HelloEJBBean implements Hello {  ... }
    hello.jsp:
    Context ctx = new InitialContext();
    Hello h = (Hello)ctx.lookup("ejb/Hello");
    web.xml:
    <ejb-ref>
    <ejb-ref-name>ejb/Hello</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>fi.kronodoc.test.model.Hello</remote>
    </ejb-ref>
    i think you should also define jndi mappings for the references in orion-ejb-jar.xml and orion-web.xml but for some reason it seems to be working also without these.

  • Jsp-servlet-bean problem

    Please help!
    I have a servlet controller, a javabean for the data and a jsp for the view.
    I cannot get the jsp using
    <jsp:useBean id="pList" class="bbs.PostListCommand" scope="request" />
    to access the bean data
    However, when I access the bean in this way
    <%@ page import="bbs.PostListCommand" %>
    // html
    <% bbs.PostListCommand postList = null;
    synchronized(session){
         postList = (bbs.PostListCommand) session.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
    // etc
    � it works
    Does anyone know why the <jsp:useBean> tag does not find the bean
    I have installed tomcat 4.18 and set the environmental variables etc.
    Directory structure is
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    Thanks in advance for any help.
    Chris

    GrayMan - Thanks for your help.
    Let me explain my problem in more detail ...
    Background:
    I have some servlet experience, but I am new to jsp - so sorry if this seems trivial to you ...
    I have a book called bitter java by bruce tate from manning.com . I am trying to get the chapter 3 examples to work
    There are three files
    PostListCommand          the bean
    PostListController     the servlet
    PostListResults          jsp
    And a new test file � PostListResults version 2 with scriptlet code to access the bean.
    There are a couple of typos in the downloaded source files, but nothing that causes the main problem of not being able to access the bean data.
    Program flow
    Servlet instantiates new bean
    Bean � gets data from db
    Servlet passes bean to jsp with a forward
    Jsp outputs data
    I have put the files in the directories �
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    The complete source code for each file is given below.
    1 I have checked the db access � that�s ok
    2 I have also checked reading the bean data back in from the request scope and printing out the results from within the servlet.- ok
    3 I can access the data through a scriptlet (PostListResults version 2), but not with the original PostListResults which uses <jsp:useBean>
    thanks in advance, chris
    PostListController.java
    package bbs;
    // Imports
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    // Import for commands used by this class
    import bbs.PostListCommand;
    public class PostListController
    extends javax.servlet.http.HttpServlet
    implements Serializable {
    * DoGet
    * Pass get requests through to PerformTask
    public void doGet(
    HttpServletRequest request,
    HttpServletResponse response)
    throws javax.servlet.ServletException, java.io.IOException {
    performTask(request, response);
    public void performTask(
    HttpServletRequest request,
    HttpServletResponse response) {
    try {
    PostListCommand postList = (bbs.PostListCommand) java.beans.Beans.instantiate(getClass().getClassLoader(),"bbs.PostListCommand");
    postList.initialize();
    postList.execute();
    request.setAttribute("PostListCommand", postList);
    ServletContext sc = this.getServletContext();
    RequestDispatcher rd =
    sc.getRequestDispatcher("/jsp/PostListResults.jsp");
    rd.forward(request, response);
    } catch (Throwable theException) {
    theException.printStackTrace();
    PostListCommand.java
    package bbs;
    import java.io.*;
    import java.sql.*;
    //import COM.ibm.db2.jdbc.*;
    import java.util.*;
    * Insert the type's description here.
    * Creation date: (07/17/2001 5:07:55 PM)
    * @author: Administrator
    public class PostListCommand {
    // Field indexes for command properties     
    private static final int SUBJECT_COLUMN = 1;
    private static final int AUTHOR_COLUMN = 2;
    private static final int BOARD_COLUMN = 3;
    protected Vector author = new Vector();
    protected Vector subject = new Vector();
    protected Vector board = new Vector();
    // SQL result set
    protected ResultSet result;
    protected Connection connection = null;
    * execute
    * This is the work horse method for the command.
    * It will execute the query and get the result set.
    public void execute()
    throws
    java.lang.Exception,
    java.io.IOException {
    try {
    // retrieve data from the database
    Statement statement = connection.createStatement();
    result =
    statement.executeQuery("SELECT subject, author, board from posts");
    while (result.next()) {
    subject.addElement(result.getString(SUBJECT_COLUMN));
    author.addElement(result.getString(AUTHOR_COLUMN));
    board.addElement(result.getString(BOARD_COLUMN));
    result.close();
    statement.close();
    } catch (Throwable theException) {
    theException.printStackTrace();
    * getAuthor
    * This method will get the author property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getAuthor(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) author.elementAt(index);
    * getBoard
    * This method will get the board property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getBoard(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) board.elementAt(index);
    * getSubject
    * This method will get the subject property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getSubject(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) subject.elementAt(index);
    * initialize
    * This method will connect to the database.
    public void initialize()
    throws java.io.IOException {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    // URL is jdbc:db2:dbname
    String url = "jdbc:db2:board";
    // URL is jdbc:odbc:bitter3board
    String url = "jdbc:odbc:bitter3board";
    // connect with default id/password
    connection = DriverManager.getConnection(url);
    } catch (Throwable theException) {
    theException.printStackTrace();
    * Insert the method's description here.
    * Creation date: (07/17/2001 11:38:44 PM)
    * @return int
    * @exception java.lang.IndexOutOfBoundsException The exception description.
    public int getSize() {
    return author.size();
    PostListResults.jsp
    <HTML>
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <H1>All Messages</H1>
    <P>
    <jsp:useBean id="postList" class="bbs.PostListCommand" scope="request"></jsp:useBean>
    <TABLE border="1">
    <TR>
    <TD>Subject</TD>
    <TD>Author</TD>
    <TD>Board</TD>
    </TR>
    <% for (int i=0; i < postList.getSize(); _i++) { %>
    <TR> <TD><%=postList.getSubject(_i) %></TD>
    <TD><%=postList.getAuthor(_i) %></TD>
    <TD><%=postList.getBoard(_i) %></TD>
    </TR>
    <% } %>
    </TABLE>
    <P>
    </BODY>
    </HTML>
    PostListResults.jsp version 2 � with scriplet code instead of useBean
    <HTML>
    <%@ page import="bbs.PostListCommand" %>
    <!-- This file was generated by the chris -->
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <% bbs.PostListCommand postList = null;
    synchronized(request){
         postList = (bbs.PostListCommand) request.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
              <TR>
              <TD>Subject</TD>
              <TD>Author</TD>
              <TD>Board</TD>
              </TR>
         <% for (int i=0; i < postList.getSize(); _i++) { %>
                   <TR> <TD><%=postList.getSubject(_i) %></TD>
              <TD><%=postList.getAuthor(_i) %></TD>
              <TD><%=postList.getBoard(_i) %></TD>
              </TR>
         <% } %>
              </TABLE>
    <%     }
    }%>
    <P>
    goodnight
    </BODY>
    </HTML>

  • Sample jsp servlet bean (MVC) code

    We want to look into the JSP/Servlet/Bean area for our next project. We wish to understand the technology and as such want to hand build simple applications, and as such do not want to use JDeveloper just yet.
    We have searched and searched for suitable material but cannot anywhere find a sample application that :
    A. Lists contents of a databse table
    B. Each item in trhe list is a link to a page that allows that item, to be edited.
    C. A new item can be added.
    D. Uses the MVC model of JSP/Servlet and bean (preferably with no custom tags)
    There are examples that are too simplistic and do not cover the whole picture. Having spent over 100 GBP on books lately, only to be disappointed with the examples provided, we need to see some sample code.
    The samples provided by Oracle are too simplistic. They should really have provided ones built around the EMP and DEPT tables.
    Anyone know where we can get hold of this sample code.

    At the risk of sounding really dumb the examples are just too complex. There does not appear to be anywhere on the web where I can find a simple JSP/servlet/bean example of the type I described. There is enouigh material describing each individual component, but what I need is an example to cement the ideas, but the ones suggested are too much for a newbie. Even the much vaunted Pet Store thingy causes my eyes to glaze over.
    I dont expect anyone to have written something with my exact requirements, but surely to goodness there must be something that:
    1. On entry presents a search form on a table (e.g. EMP)
    2. On submission list all rows in EMp matchiung the criteria.
    3. The user can either click the link 'Edit' which opens up a form dispalying the row allowing the user to edit and save the changes, or click the 'New' button to show a blank form to create a new EMP.
    All this via a Controller servlet, with the database logic handled by a java bean, and all the presentation done via JSP.
    To me this is the most obvious and instructive example of this technology, but after days of trawling the web, and looking through a number of books, I cannot find such a thing.
    CGI with Perl DBI/DBD was a breeze to work with compared to this stuff ..... maybe ASP with SQL/Server would be a more fruitful use of time.

  • [Help] How you guys do the performance test for Hyperion?

    Dear All,
    Currently, we are building the performance test scripts by using the QALoad. We have identified the following areas for the test.
    * Planning Data Form
    * Financial Report
    * SmartView
    However, we hit a number of question.
    For Financial Report, when the recorded scripts were playback, we cannot see any pdf files generated under folder $BIPLUS_HOME/temp/.
    For SmartView, the recorded scripts just don't work after the Hyperion Services were restarted.
    Does anyone have any experience on doing performance test for Hyperion, especially using QALoad? Is there any technical reference out there we can read?
    Regards,
    Martin

    When we playback the QALoad script for Financial Report, we got the following error response!
    As you know, when opening an Finacial Report, it will auto login the Datasource. There is no need to provide the username/password. We are wondering if this is related to our problem or not. Please kindly help. We have been spending days/weeks to record the testing scripts.
    Does anyone has any idea?
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <BpmResponse type="error" action="">
    <code>5517</code>
    <desc>Logon Failed, User Name must not be empty</desc>
    <trace>com.hyperion.reporting.util.HyperionReportException: Logon Failed, User Name must not be empty
         at com.hyperion.reporting.api.HRReports.Authorize(Unknown Source)
         at com.hyperion.reporting.api.HRReports.Authenticate(Unknown Source)
         at modules.com._hyperion._reporting._web._reportviewer._HRRunDlg._jspService(_HRRunDlg.java:1075)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at com.hyperion.reporting.webviewer.HRLocaleFilter.doFilter(Unknown Source)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:797)
    </trace>
    </BpmResponse>
    Regards,
    Martin

  • Returning ResultSet from servlet to jsp - java.lang.NullPointerException

    Hey all, i've been stuck on this for too long now...just trying to return a ResultSet from a servlet to jsp page.
    Had a bunch of problems earlier...which i think were fixed but...now i get a "java.lang.NullPointerException" in my jsp page when i try to get elements from the ResultSet object.
    Here is the latest version of my code:
    Servlet:
    String QueryStr="select ProdName from products";
    Statement stmt=conn.createStatement();
    rs=stmt.executeQuery(QueryStr); //get resultset
    sbean.setInventory(rs); //set ResultSet in bean
    req.getSession(true).setAttribute("s_resbean",sbean); //create session/request variable, set to bean
    Bean:
    package beans;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    public class SearchBean extends HttpServlet{
         private int searchFlag=0;
         private ResultSet inventory;
         public SearchBean(){
         public int getSearchFlag(){
         return searchFlag;
         public ResultSet getInventory(){
              return inventory;
         public void setInventory(ResultSet rs){
              this.inventory=rs;
         public void setSearchFlag(){
              this.searchFlag=1;
    jsp:
    <%@ page language="java" import="java.lang.*,java.sql.*,javax.sql.*,PopLists.PopInvLists,beans.SearchBean"%>
    <jsp:useBean scope="session" id="s_resbean" class="beans.SearchBean" />
    <% ResultSet categories=PopInvLists.getCat();
    ResultSet manuf=PopInvLists.getManuf();
    ResultSet supplier=PopInvLists.getSupplier();
    ResultSet cars=PopInvLists.getCars();
    ResultSet search=(ResultSet)request.getAttribute("s_resbean");
    %>
    <%     while(search.next()){
         String pname=search.getString("ProdName");
    %>
    It craps out when i try to loop through the "search" ResultSet.
    I can loop through the rest of the ResultSets no problem....just this one doesn't work because it's set in a servlet, not a simple java class.
    Just to clarify, i am populating some dropdown lists on entry to the screen, which the user will use to perform a search. Once the search btn is clicked, the servlet is called, gets the request info for the search, performs search, and returns the resultset to the original screen. I want to eventually display the result under the search criteria.
    Someone....Please Please please tell me how to get this working...it should be very simple, but i just can't get it to work.
    Thanks in advance,
    Aditya

    req.getSession(true).setAttribute("s_resbean",sbean); //create session/request variable, set to beanHere you add an attribute to the session.
    ResultSet search=(ResultSet)request.getAttribute("s_resbean");Here you try to get the attribute from the request. Naturally it isn't there because you added it to the session, not the request. Despite your comment in the first line of code, a session is not a request. And vice versa.

  • What should I take note when converting Servlets to JSPs files?

    Hi Everyone,
    I have a web application that currently runs using Servlets and JSP, but i intend to change every servlet file into JSP.
    What should I take note?
    Please advice and comment.
    Thanks in advance

    Ok, I can see your logic, but I don't agree with it.
    It may SEEM like you'll save time, but I'm pretty sure you wouldn't in the end.
    So you don't have to restart the Tomcat server so much.
    That still doesn't justify writing java code into a JSP.
    Whatever you gain from not restarting the server you will lose 10 times over from stupid compile errors/typos that come from writing scriptlet code in a JSP.
    Java code belongs in a java class, where you can take advantage of all of the assistance of the IDE for code completion, formatting, compiling, syntax checking etc.
    Also if you write your code in classes, you can test them with Junit tests - something harder to do when your logic is embedded in JSPs
    Write your java code where it is meant to be. In java classes. Beans/Servlets/whatever.
    A JSP is for one purpose only - to produce an HTML page.
    Just my 2 cents.
    evnafets

  • Newbie question : How to call a servlet from JSP?

    my web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <display-name>Test</display-name>
      <description>
         Test
      </description>
    <servlet>
            <servlet-name>Test1</servlet-name>
            <servlet-class>Test1</servlet-class>
        </servlet>
        <servlet-mapping>
           <servlet-name>Test1</servlet-name>
           <url-pattern>/test1</url-pattern>
        </servlet-mapping>
         <security-constraint>
          <web-resource-collection>
             <web-resource-name>Protected Group</web-resource-name>
          <!-- Define the context-relative URL(s) to be protected -->
             <url-pattern>/jsp/security/protected/*</url-pattern>
          <!-- If you list http methods, only those methods are protected -->
          <http-method>DELETE</http-method>
             <http-method>GET</http-method>
             <http-method>POST</http-method>
          <http-method>PUT</http-method>
          </web-resource-collection>
          <auth-constraint>
             <!-- Anyone with one of the listed roles may access this group -->
             <role-name>tomcat</role-name>
          <role-name>role1</role-name>
          </auth-constraint>
        </security-constraint>
        <!-- Default login configuration uses BASIC authentication -->
        <login-config>
          <auth-method>BASIC</auth-method>
          <realm-name>Example Basic Authentication Group</realm-name>
        </login-config>
    </web-app>my index.html
    <html>
    <body>
    <a href="/test1">test</a>
    </body>
    </html>I put my Test1.class in ../WEB-INF/classes.
    When I click the link for test1, I got the following message
    HTTP Status 404 - /test1
    type Status report
    message /test1
    description The requested resource (/test1) is not available.
    Apache Tomcat/4.1.18-LE-jdk14please help. thanks

    Hi,
    You have not said if your servlet is in a package in which case which one.
    you need to add the '/servlet/' to the href so it becomes
    '/servlet/test1'.
    Phil

  • InterMedia Java Classes for Servlets and JSPs and Netscape

    I am using the interMedia Java Classes for Servlets and JSPs to upload and retrieve multimedia data. I have found that it is much more performant in Internet Explorer (5.5) than in Netscape Communicator (4.7). In fact, I cannot upload images larger than 10K at all using netscape. However, the same image can be uploaded into the same application using IE. Is this a known issue?
    Thanks in advance.

    Hi,
    We have successfully uploaded multimedia data in the giga-byte range (Quicktime and AVI files) at the same speed with both the Netscape (4.7n) and MS IE (4.n and 5.n) browsers. One thing we have noticed is that its very important to set the manual proxy settings correctly if you have an environment with a proxy server. If you don't, then uploads can go via the proxy server and, for some reason, that seems to take considerably longer. For example, suppose you are in the www.xyzco.com domain and are connecting to a host named webserver.www.xyzco.com, then specify webserver and webserver.www.xyzco.com (to cover both cases) in the "Do not use proxy servers for..." box in the manual proxy server configuration screen. Also, if you're using a tool such as JDeveloper that uses the host IP address in the debugger environment, then you also need to add the numeric-based (nnn.nnn.nnn.nnn) IP address to this list.
    Hope this helps.
    In order to better understand the variety of ways in which our customers are using interMedia, we'd be very interested in knowing a little more about your application, the interMedia functionality that you are using, and how you are developing and deploying your application. If you are able to help us, please send a short email message with some information about your application, together with any comments you may have, to the Oracle interMedia Product Manager, Joe Mauro, at [email protected] Thank you!
    Regards,
    Simon
    null

  • Differences between WL or Netscape for Servlets and JSP's

    What are the advantages / disadvantages of running Servlets under WL,
              vs. say, running them in Netscape's servlet engine? Assuming EJB
              container is run separately, either one of these could make calls to the
              WL EJB server, so perhaps it would be simpler and faster to run servlets
              and JSP's under Netscape, and have them call via t3 into a weblogic
              server for EJB's?
              Thoughts
              david
              David Michaels <[email protected]>
              Director of Technology
              ShockMarket Corporation (650) 330-4665
              [david.vcf]
              

    David,
              One of the major reasons to run your servlets on Weblogic is that we have an
              optimization that allows us to pass by reference objects when calling from
              servlets to EJB. This makes things much faster.
              A number of our customers, in addition, have seen performance problems when
              using other servlet engines. It just seems to cause problems due to their
              threading models etc.
              Finally, our servlet engine is by far the most mature and robust on the
              market today. Our JSP implementation is also the best in terms of
              performance.
              Thanks,
              Michael
              Michael Girdley
              WLS Product Manager
              David Michaels <[email protected]> wrote in message
              news:[email protected]..
              > What are the advantages / disadvantages of running Servlets under WL,
              > vs. say, running them in Netscape's servlet engine? Assuming EJB
              > container is run separately, either one of these could make calls to the
              > WL EJB server, so perhaps it would be simpler and faster to run servlets
              > and JSP's under Netscape, and have them call via t3 into a weblogic
              > server for EJB's?
              >
              > Thoughts
              >
              > david
              >
              > --
              > David Michaels <[email protected]>
              > Director of Technology
              > ShockMarket Corporation (650) 330-4665
              >
              >
              

  • ATG Servlet Beans - serviceLocalParameter vs serviceParameter

    can you explain the difference between serviceLocalParameter and serviceParameter used in ATG Servlet Beans?

    Hi Gautam,
    I have tried to run following example:
    //my custom droplet page
    public class PrintDroplet extends DynamoServlet{
         ParameterName name=ParameterName.getParameterName("name");
         public void service(DynamoHttpServletRequest pRequest,DynamoHttpServletResponse pResponse)throws ServletException,IOException{
                   pRequest.setParameter("myvalue", pRequest.getParameter(name));
                   pRequest.serviceParameter("output2", pRequest, pResponse);
    //my .jsp page code
    dsp:page>
         <dsp:importbean bean="/com/training/club/tools/PrintDroplet"/>     
         <dsp:droplet name="PrintDroplet">
              <dsp:param name="name" value="Mishra"/>
              <dsp:oparam name="output2">
                   output is :
                   <dsp:valueof param="myvalue"/>......................(1)
              </dsp:oparam>
         </dsp:droplet>
         <dsp:getvalueof id="v" param="myvalue">
              Global value is :<dsp:valueof value="<%=v %>" />..........................(2)
         </dsp:getvalueof>
    </dsp:page>
    I am able to print value of .....(1) but not of ....(2).
    Am I implementing right? If no, Kindly provide right way to understand it with this implementation.
    Thanks in advance.
    -RMishra

Maybe you are looking for