Multi Servelt Vs Single Servlet Pattern

Hi,
Can somebody throw some light on where and when to go for a multiple servlet pattern and when to opt for a single servlet solution.
As for example, I have to develop an application for Customer rating. So, I have two modules one Customer and other Rating. These two will be sending requests to the web-server. I want to use Servlets for handing those requests. I wanted to know whether I should keep seperate servlets (CustomerServlet & RatingServlet) for each module and chain them up for common processing or should I use a single servlet(AppServlet) handling all the requests from all modules.
I would appreciate if I can get any reference to the reading material available on internet on this.

Hi Rakesh,
what u can do is Use a single servlet(AppServlet) handling all the requests from all modules. Keep your Security Module separate if u want to have all your WebPages check USer Session.
cheers,
Sachin

Similar Messages

  • Scalability of single servlet for application

              Hi,
              The J2EE blue prints recomends the single servlet approach as a controller and
              entry point for the application. How does this scale up in Weblogic server for
              a website with a very heavy load of many concurrent users. Right now we are planning
              to use Weblogic 6.1 for the portal development
              REgards
              Barath
              

    WLS 5.1 only uses a single instance per servlet, but it is multi-thread. So if your
              service method is not synchronized, or not using any synchronizing within service
              method, there should be no scale up problem.
              Just curious, why doesn't WLS webserver use several instances under heavy load?
              minjiang
              Mike Reiche wrote:
              > There is no scaling issue here. Hitting a single servlet many times is equivalent
              > (processing-wise) to hitting many servlets fewere times.
              >
              > Mike
              >
              > "barath" <[email protected]> wrote:
              > >
              > >Hi,
              > > The J2EE blue prints recomends the single servlet approach as a controller
              > >and
              > >entry point for the application. How does this scale up in Weblogic server
              > >for
              > >a website with a very heavy load of many concurrent users. Right now
              > >we are planning
              > >to use Weblogic 6.1 for the portal development
              > >
              > >REgards
              > >Barath
              

  • Can we have more than one service method in a single servlet

    can we have more than one service method in a single servlet?explain with example

    No, you can only have one service method. However, you can have it process two different requests as follows.
    Lets say you have two JSP pages. Put a hidden text value in one called jsp1 and a hiddent text value in the other called jsp2 (example: <input type="hidden" name="jspPage" value="jsp1"> and <input type="hidden" name="jspPage" value="jsp2">.
    Then in your service method, read in request.getParameter("jspPage") to determine if its jsp1 or jsp2 and call up the appropriate logic to process them separately.

  • Taking in many concurrent requests via a single servlet

    Hi,
    My objective for this topic is to find a way to make my tomcat app able to handle as many as possible concurrent requests.
    My app spec is
    -servlet running on Tomcat 5.0
    My app is a mobile text messaging app that receives requests via a single servlet, called InboundRequest. This servlet will,
    1. Read the HTTP params in the request
    2. Decide to which other servlet classes it should forward to (RequestDispatcher)
    3. The recipient servlet will read the HTTP param, process it and outputs the data via OutboundResponse java class.
    So, my issue is,
    1. What factor decides the number of concurrent requests my InboundRequest servlet can handle? Is it my code or Tomcat itself or the server hardware
    2. Since I'm using Request Dispatcher forwarding, if say i have a request that takes 5 seconds to complete the its task (to output the result via OutboundResponse), will in inhibits/stops any other requests that comes in during that 5 seconds?
    I appreciate all expertise i can get.
    Regards,
    Mel.

    There is nothing to worry about that concurrent request handling as container will create one instance of your servlet and then for each client request it will spwan a single thread which will handel the client request.If u r implementing SingleThreadModel then onle one thread will be spwan and it will handle the requests one by one .So it will be slower .

  • How should implement multi-thread in single-threaded Operating system using

    How should implement multi-thread in single-threaded Operating system using java?
    Java supports "Multi-threading".Is there is any way run the multiple threads (Implementing multi threading) using java in a Single-threaded Operating system (That is the operating system does not support for multi-threading).

    Previous questions from OP suggest they are using J2ME, so the question might be possible.
    806437 wrote:
    How should implement multi-thread in single-threaded Operating system using java?
    What is the actual question/problem?
    A java app doesn't do threads or not do threads. It uses classes. The VM does threads.
    So if you have a platform that does not have threads and you want to support the thread class then the VM, not a java app, must provide some pseudo mechanism, such as green threads, to support that.
    If your question is about java code and not the VM then you must build a task engine and insure that the tasks are of short enough duration that it is an effective use for your system.

  • Get all values from multi select in a servlet

    Hello,
    I have a multi <select> element in a HTML form and I need to retrieve the values of ALL selected options of this <select> element in a servlet.
    HTML code snippet
    <select name="elName" id="elName" multiple="multiple">
    Servlet code snippet
    response.setContentType("text/html");
    PrintWriter out = null;
    out = response.getWriter();
    String output = "";
    String[] str = request.getParameterValues("elName");
    for(String s : str) {
    output += s + ":";
    output = output.substring(0, output.length()-1); // cut off last deliminator
    out.println(output);But even when selecting multiple options, the returned text only ever contains the value of the first selected option in the <select>
    What am I doing wrong? I'm fairly new to servlets
    Edited by: Irish_Fred on Feb 4, 2010 12:43 PM
    Edited by: Irish_Fred on Feb 4, 2010 12:44 PM
    Edited by: Irish_Fred on Feb 4, 2010 2:14 PM
    Edited by: Irish_Fred on Feb 4, 2010 2:26 PM
    Edited by: Irish_Fred on Feb 4, 2010 2:26 PM
    Edited by: Irish_Fred on Feb 4, 2010 2:32 PM

    I am using AJAX.
    I will show you how I'm submitting the <select> values by showing you the flow of code:
    This is the HTML code for the <select> tag and the button that sends the form data:
    <form name="formMain" id="formMain" method="POST">
         <input type="button" id="addOpts" name="addOpts" value="Add Options" style="width:auto; visibility:hidden" onClick="jsObj.addOptions('servletName', document.getElementById('elName'))">
         <br>
         <select name="elName" id="elName" multiple="multiple" size="1" onChange="jsObj.checkSelected()">
              <option value="0"> - - - - - - - - - - - - - - - - </option>
         </select>
    </form>Note that the "visibility:hidden" part of the button style is set to "visible" when at least one option is selected
    Note that "jsObj" relates to a java script object that has been created when the web app starts ( The .js file is included in the .jsp <head> tag )
    The following code is taken from the file: "jsObj.js"
    jsObj = new jsObj();
    function jsObj() {
    //=================================================
         this.addOptions = function(url, elName) {
              var theForm = document.getElementById('formMain');          
              if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
                   xmlhttp=new XMLHttpRequest();
              } else { // code for IE6, IE5
                   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              url += this.buildQueryString(theForm.name);
              xmlhttp.open("POST",url,true);
              xmlhttp.send(null);
              xmlhttp.onreadystatechange=function() {
                   if(xmlhttp.readyState==4) { // 4 = The request is complete
                        alert(xmlhttp.responseText);
    //=================================================
    this.buildQueryString = function(formName) {
              var theForm = document.forms[formName];
              var qs = '';
              for (var i=0; i<theForm.elements.length; i++) {
                   if (theForm.elements.name!='') {
                        qs+=(qs=='')? '?' : '&';
                        qs+=theForm.elements[i].name+'='+escape(theForm.elements[i].value);
              return qs;
         //=================================================
    }And this is a code snippet from the "servletName" servlet:public synchronized void doGet(HttpServletRequest request,
              HttpServletResponse response) throws ServletException,IOException {
              PrintWriter out = null;
              try {
                   response.setContentType("text/html");
                   out = response.getWriter();
                   String output = "";
                   String[] values = request.getParameterValues("elName");
                   for(String s : values) {
                        output += s + ":";
                   output = output.substring(0, output.length()-1); // cut off last delimitor
                   out.println(output);
                   } catch (Exception e) {
         }So anyway, everthing compiles / works, except for the fact that I'm only getting back the first selected <option> in the 'elName' <select> tag whenever I select multiple options
    Edited by: Irish_Fred on Feb 7, 2010 10:53 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • MVC Design Help, Single Servlet, How do I access the Model and DB

    Hi all. New here and looking for some help.
    I am currently writing a website that allows the creation of users, that may upload articles and post comments on articles. Im trying to develop using MVC. I have a single controller servlet that processes POST actions throughout the site (eg. InsertArticle, DeleteArticle, ModifyArticle, etc..)
    Now my problem is, just how do I retrieve the articles from the database? .. for example, if I load up a page http://localhost/articles.jsp which should display all the articles currently in the site.. I would have a function say getAllArticles() which should return a collection of all the articles. I can then iterate through the articles in the jsp page.
    I am trying to use <jsp:useBean...etc.> BUT.. my articles bean constructor takes a databaseconnection object as a parameter. If I use useBean I cant pass the databaseconnection object to the bean and I get an error because it cannot create the bean.
    Any help on this would be appreciated as well as any tutorial links. I also looked at the petstore blueprint program on the sun website, but that program has me completely lost with all the xml. I would prefer not to use custom tags or struts for now. I would like to keep it simple with snippets of java code in the jsp pages for data retrieval and display while keeping all the business logic in the beans of the model. I would also like to keep this relatively secure. I am developing using Oracle Jdeveloper 10g.
    Thanks
    Jazz

    Hey steve, thanks for that.. but thats exactly what i
    dont want to do. I also realize that ive been writing
    the ejb's incorrectly to begin with and have begun to
    rewrite them. However maybe I can make it easier..
    what im trying to do is precisely what is in this
    diagram..
    http://gsraj.tripod.com/jsp/jsp.html
    the problem im having is where it passes data back to
    the jsp page.. entity beans cant (or shouldnt?) be
    accessed directly from jsp pages.. which means i
    create a session bean which interacts with the entity
    bean and can return information to the jsp page.. i
    understand what i have to do.. i just dont know how to
    do it.. been searching for google for tutorials and
    etc.. this site is the closest ive come but .. as you
    can see it says "more to come" ..
    thanks again guys really appreciate itAhhh. EJBs. Enterprise Java Beans and JavaBeans are two completely different beasts. I know nothing about EJBs, except:
    1) They are much harder to use (and serve a different purpose I assume) then JavaBeans
    2) Tomcat (the server I use) doesn't support them.
    Sorry I can't be of more help.

  • Set Database Back to Multi User from Single User

    I am using SharePoint Services 3.0 (SP1) with default configuration options, which installs the Microsoft##SSEE instance of SQL to my local C:\ drive.
    While attempting to relocate the files to another drive, I set one of the databases (as recommended) to Single User by using the SQL Server Management Express tool.
    I cannot now reset that database to Multi User, even by executing the query
    exec sp_dboption 'database_name', 'single user', ''FALSE'
    again by using the Management Express Tool.
    Can someone please help, in plain english???? Thanks

    I have similar issue.
    I have took backup of WSUS (Windows Server 2002 R2) Windows internal database using SQL Server 2008 Management Studio and restored on Windows Server 2012 R2 Server.
    Now SUSDB database was in Single User mode. I have tried ALTER  DATABASE <<Database Name>>   SET MULTI_USER  WITH NO_WAIT and i'm getting blow error.
    Msg 5069, Level 16, State 1, Line 1
    ALTER DATABASE statement failed.
    How i can change it Multi User?
    Thanks 
    Uma

  • Multi GR's Single CENVAT Credit

    Hai Friends,
    I have one issue.I have raised one PO with 2 line item with same material.. delivery dates different. I have received multi Deliveries, So i have done 2 GRs.. How can i do single CENVAT Credit avail.
    Please help it out

    Hi,
    During GR, select "Only Part1" under "Excise Invoice" Tab Page.
    And then go to J1IEX and Capture Excise Invoice > Goods Receipt

  • [JS] [CS2] Change all from multi line to single line composer

    Hi
    Does anyone know how to change all paragraphs, on all pages, in all textframes, from multi line composer to single line composer...
    Thanx
    Tim

    This should work:
    app.documents[0].stories.everyItem().composer = "Adobe Single-line Composer"
    Dave

  • Regarding multi sources to single target

    Hi all,
    In which case( business need) we will go for multi messages to a single one(n:1) mapping.
    so far I have encountered 1:n but not vice versa.
    Please explain business need and give some blogs to practice.
    Thanks

    Hi,
    Imagine you receive an order, call an RFC to do a lookup for a partner number and send the order to a receiver system with the partner number obtained from the RFC.
    You will create an integration process that first receives the order. It then calls the RFC and the output from the RFC is stored in the container.
    In order to create the output order, data from the first order is needed, as well as the output from the RFC. In order to do this, you call a mapping that takes two input documents (the original order and the response from the RFC) and map those to the output order.
    This blog gives an example of another multi-mapping scenario: <a href="/people/pooja.pandey/blog/2005/07/27/idocs-multiple-types-collection-in-bpm">IDOCs (Multiple Types) Collection in BPM</a>
    Kind regards,
    Koen

  • Multi tier to single tier

    Hi,
    I am planning to clone from a multi tier( db+car==>1 and web+forms==>2 ) to single tier.
    Which application folders (appl_top,comn_top etc) should I copy?
    Shall I copy both or only one will do?

    Hi;
    What is your EBS and OS?
    Please check clone docs:
    Cloning Oracle Applications Release 12 with Rapid Clone [ID 406982.1]
    Cloning Oracle Applications Release 11i with Rapid Clone [ID 230672.1]
    Also see:
    FAQ: Cloning Oracle Applications Release 11i http://ID 216664.1
    Troubleshooting RapidClone issues with Oracle Applications R12 [ID 603104.1]
    Regard
    Helios

  • Multi Schema to single schema.

    Hi,
    I am new to streams.
    Can it be possible to push the changes from multi schemas to a single schema? Structure for the consolidated schema will be same as other source schemas. Juast an additional column in target tables. I would like populate a unique id for each schema.
    Any example is much appreciated.
    Thanks.

    It is possible. But you have to change the schema name in the changes by using a dml-handler or a transformation rule. For a dml handler I have an example:
    CREATE OR REPLACE PROCEDURE emp_dml_handler(in_any IN SYS.AnyData) IS
    lcr SYS.LCR$_ROW_RECORD;
    rc PLS_INTEGER;
    command VARCHAR2(10);
    old_values SYS.LCR$_ROW_LIST;
    BEGIN
    -- Access the LCR
    rc := in_any.GETOBJECT(lcr);
    -- Get the object command type
    command := lcr.GET_COMMAND_TYPE();
    -- Check for DELETE command on the employees table
    IF command = 'DELETE33' THEN
    -- Set the command_type in the row LCR to INSERT
    lcr.SET_COMMAND_TYPE('INSERT');
    -- Set the object_name in the row LCR to EMP_DEL
    lcr.SET_OBJECT_NAME('DESTINATION.EMPLOYEES');
    -- Get the old values in the row LCR
    old_values := lcr.GET_VALUES('old');
    -- Set the old values in the row LCR to the new values in the row LCR
    lcr.SET_VALUES('new', old_values);
    -- Set the old values in the row LCR to NULL
    lcr.SET_VALUES('old', NULL);
    -- Add a SYSDATE value for the timestamp column
    -- lcr.ADD_COLUMN('new', 'TIMESTAMP', SYS.AnyData.ConvertDate(SYSDATE));
    -- Apply the row LCR as an INSERT into the emp_del table
    lcr.EXECUTE(true);
    END IF;
    END;
    BEGIN
    DBMS_APPLY_ADM.SET_DML_HANDLER(
    object_name => 'source.employees',
    object_type => 'TABLE',
    operation_name => 'INSERT',
    error_handler => false,
    user_procedure => 'strm_emp_admin.emp_dml_handler',
    apply_database_link => NULL,
    apply_name => NULL);
    END;
    Regards,
    Martien

  • How i use multi panel in single applet

    hi master
    sir i need three panel in single applet
    i use this code but not set the panel
    pnl.setBounds(20, 10, 10, 20);
    and
    pnl.setLocation(12, 12);
    and
    pnl.setSize(12, 20);
    this is my class code
    JTable table = new JTable(rdata, columnNames);
    getContentPane().add(table.getTableHeader(),BorderLayout.NORTH);
    getContentPane().add(table);
    JPanel pnl = new JPanel();
    //pnl.setBounds(20, 10, 10, 20);
    //pnl.setLocation(12, 12);
    pnl.setSize(12, 20);
    pnl.add(new JScrollPane(table));
    getContentPane().add(pnl);
    //pnl.setBounds(10, 10, 10, 20);
    please sir give me idea how i use multi panel and how i set panel boundry
    thanking you
    aamir

    http://forum.java.sun.com/thread.jspa?threadID=5118094&tstart=0

  • Oracle Multi-Bytes vs Single-Byte

    Hi,
    We have to add japanese to our application, i had succesfully add japanese data in our single-byte database,
    so why should we use a Multi-byte DB?
    what is the gain to use a Multi byte DB vs a Single Byte?
    does intermedia work with japanese in Single Bytes?
    Is utf8 the best way to have an international DB?
    We will have to add a lot of other char-set in the future.
    Thanks

    so why should we use a Multi-byte DB?
    what is the gain to use a Multi byte DB vs a Single Byte? What you are doing is storing invalid multibyte characters into a single byte database. So each double byte Japanese characters are being treated as 2 separate single byte characters. You are using an unsupported but common garbage in garbage out approach, so in that sense you are using Oracle as a garbage container. :)
    Let's look at some of the issues that you are going to have :-
    All SQL Functions are based on the property of the single byte database character set WE8ISO8859P1. So LENGTH(), SUBSTR (), INSTR (), UPPER(), NLS_UPPER etc .. will yield incorrect results . For example a column with one Japanese character and one ASCII character will return a length of 3 characters rather than 2 characters. And if you want to locate a specific character in a mix ASCII and Japanese string using the SUBSTR() it will be very difficult, because to Oracle the string consists of all single byte characters, it will not skip 2 bytes for a Japanese character. Even if you don't have mix strings, you will need to write one routine for handling ASCII only and another for Japanese strings.
    Invalid Data conversion , if your need to talk to another db using dblink say ,all the character conversion will be based on the single byte character set to the target database character set mapping, so the receiver will lose all the source Japanses characters and will get 2 single byte characters for each Japanese char instead .
    Export and Import will have identical problems, character set conversion are performed during these operations, so all Japanese characters will be lost. This also means that you can not load correctly encoded Japanese data into your current single byte DB using IMPORT or SQLLOADER without data corruption ...
    does intermedia work with japanese in Single Bytes?No
    Is utf8 the best way to have an international DB?Yes
    null

Maybe you are looking for

  • Html print

    we are designing an xdp form to be rendered by the adobe forms server as an html form.I am looking for a print button that will print the pdf rendered version of the form with the data from the html.in other word when the client clicks on the print b

  • How to create Ad hoc Querry.

    Hi All, When I am generating Infoset it is displaying log with some errors,How to solve those errors. So please anybody can tell me that how to create 1). User group. 2). Infoset. 3). Querry. Regards. Skanth.

  • Preview does not show any postscript files

    Preview does not show any .ps files in Mac OS 10.4.3. I get an error message "PostScript Conversion Error" when Preview tries to convert the ps file into pdf. (I print online banking invoices to postscript using the print option "save as file", becau

  • Why do I get and error when attempting to install the lighting calendar that it is not compatible with firefox 34.0.5..

    I am using firefox 34.0.5, my thunderbird is 31.3.0 and I am attempting to install the lightning calendar. I checked the compatibility list. I downloaded the correct version of lightning and each time i attempt to install any version it fails and giv

  • Publishing an APO Planning book to  EP

    Any ideas on publishing an APO planning book to EP? Are there are business packages available? Couldn't find any on Iviewstudio.