Handling multiple requests in servlets

Dear friends,
in my application i have a html form and a servlet
From LAN 60 students(clienst) will access the form simultaneously
i have to collect data from all clients and generate a report based on their inputs
how do i collect data from 60 clients
regards
Ram Mohan

Your using html and a servlet? I suggest JSP and a servlet. I also suggest reading book on JSP that also covers servlets. Keep in mind that in proper MVC design, the JSP pages only displays data and submits back to the servlet. It doesn't contain business logic. The servlet calls business logic, gets data from business logic, puts it in request scope, then dispatches to the appropriate JSP page. The JSP page reads the data from request scope and displays it. If your not too familiar with JSP and servlets, I suggest you first create a hello world JSP page, and a hello world servlet.

Similar Messages

  • How to handle multiple request in the servlet

    how to handle multiple request in the servlet...
    Example:
    java forum...
    i'm login in the java forum at this time 1000 members make login in this....how happended in servlet?
    if we use thread how to implement in servlet ?

    Serlets are already threaded. The application container instantiates the servlet, then uses this instance in a new thread for every use.
    This is the reason that you should use (almost) no instance variables in a Servlet, but rather that (almost) everything should be local to the method.

  • How to handle multiple requests to the same servlet at one time?

    Hi,
    I am new to Servlets. I have doubt regarding ... Handling multiple requests to a servlet at a time.
    If we send a single request to a servlet, as know that group of objects such as servlet, servletContext, servletConfig, request, response and etc are created in the server, And if 1000's of requests are sent to a same servlet at a time, and if server memory capacity is less, then 1000's of objects are created in a server which would be heavy burden to Server. How to handle the application and development in such situation?
    Kind regards,
    veerendra

    Hi veerendra reddy ,
    By default any web server can will have a thread pool to handle client req's.
    In your point also heavy burden to server you are telling that depends on this.
    we can configure this min & max size of this thread pool.
    by default it will be 0-1000 for tomcat server.
    I am not sure in which file this configuration will be.
    But I hope in server.xml or some xml file consists this info.
    If You what you can edit accordingly. to overcome your heavy burden to server.
    Thanks & Regards
    Nagendra

  • Does a filter instance handle multiple requests?

    A web container creates a thread to handle each request so that a servlet instance handles multiple requests at the sime time. What about a filter instance? Does a filter instance also handles
    multiple requests? or it handles only one at a time

    Here's a quote from the Servlet spec (2.3):
    After deployment of the web application, and before a request causes the container
    to access a web resource, the container must locate the list of filters that must be
    applied to the web resource as described below. The container must ensure that it
    has instantiated a filter of the appropriate class for each filter in the list, and called its
    init(FilterConfig config) method..............
    Only one instance per filter declaration in the deployment descriptor is
    instantiated per Java virtual machine of the container.
    So, if the servlet engine follows the spec, there should only be one instance.

  • How to handle FTP request in Servlet

    Hi,
    can anyone tell me how to handle FTP operations in Servlet? I mean to ask whether we can handle FTP request in Servlet.
    Thanks
    Subs

    Your servlet should extend from GenericServlet and not HttpServlet to handle ftp requests.

  • How biztalk handle multiple request at a time ?

    can TCP/IP adapter or biztalk handles multiple request at a time ?
    If yes,then how it process multiple request ? 
    Can TCP/IP send ports sends multiple request ?
    Prakash

    Yes.
    It processes multiple requests using THREADS. Each Connect starts off a thread that handles the receipt of the message, submission to BizTalk, wait for the response (matching two-way subscription) and then respond back to the client.
    TCP/IP Send ports handle multiple requests by creating fresh sockets (RPC High-end ports). As an example, in your browser you open multiple tabs and access different sites, each tab results in your browser opening a fresh socket connection for the request.
    Regards.

  • Handling Multiple requests in SOAP Sender Adapter

    Hi All,
    We are working on scenario SOAP-IDOC.
    We receive multiple requests from Source, PI should process them and deliver it to SAP system.
    Now the issue is :
    The messages are in separate SOAP requests i.e. 5 messages = 5 SOAP requests.
    If sending a single message there is no issue.
    If sending multiple messages at once then a time-out occurs.(HTTP 408 Timeout) If sending
    5 SOAP requests in the same transmission then the first message will process ok but the other 4 will report an error. If the 5 SOAP requests are transmitted individually then they process ok.
    Can any one throw some pointers on this? What are the settings I have to do in PI so that sender can avoid getting HTTP 408 timeout error?
    Regards,
    Srini

    Hi Srinivasa,
    Set icm/server_port_X parameter . You can change this in RZ10 .Goto tcode RZ10 select the instance profile and select the extended maintenance and click on Change Now click on Create Parameter Tab and write the profile parameter icm/server_port_X and press enter it will show you the default value if any and then put the new value and click on save and F3 and then again save.System needs to be restarted to reflect these changes.
    Also check out the SOAP adapter FAQ on service market place. This would surely solve your problem(time out).
    Rgds
    joel

  • Dynamical Tree handling multiple requests

    Hi,
    I think I already explained well my need. I currently have an
    implementation of a tree control that is dynamic. So, when I click
    to open a node, it sends a request to server to ask for its
    children.
    Attached you have my tree code.
    And here is a sample feedback I have from server in XML:
    <response>
    <status>OK</status>
    <message/>
    <data>
    <item id="3" type="folder" label="Item 1.1"
    isBranch="true"/>
    <item id="4" type="folder" label="Item 1.2"
    isBranch="false"/>
    </data>
    </response>
    The problem is that if I the user clicks too fast to open two
    branches, only the last request is added. THe other request is
    lost, but its node keeps the down arrow. If I try to close it then,
    it crashes the app.
    My question is how do I make this code able to work with
    simultaneous requests? I already tried via AsyncToken without
    success. The main problem using tokens is how to pick the selected
    item then. =\
    Thanks in advance,
    Best regards,
    Guilherme Blanco

    Zoram wrote:
    So can u kindly advice me where should I use Servlets here in my application in order to overcome the problem.Dude, you need to study struts as well. There is an underlying servlet handling all the requests, and based on action name it decides which action class it needs to call. All this is done behind the scenes what you as a developer do is write your logic in the Action class (or may be call some services from it). So it would be easier for us, if you can share the code where you have written the logic as well your Action class code.

  • Handling multiple requests

    Hi,
    I have a servlet which handles a simple process. The retrieved value is put in session and displayed in a jsp. When 2 instances of a same jsp (like in multi user access) pass on the request to this servlet, the retrieval is correct for both instances but the session value is null when redirected to one of the jsps. What could be wrong? Please help.
    Thanks!

    A session is bound to a client, so it makes no difference if a hundred users call the servlet at the same time, they are all recieving the session variable seperately.
    So if the variable at a later point turns up null, there is a bug somewhere in your code, it's as simple as that. Typo in the name when you retrieve the session variable maybe? Perhaps the session is invalidated somehow?
    Could be anything really.

  • How to handle multiple requests from single client??

    hi all
    I wrote a client server program to handle requests from client.I have 2 types of requests, one is to submit comments to the server other is to view comments on the server.I have tested the app and it works fine for either of them(independently) but they don't work both together i.e when i submit a comment and view it,it's stuck and when i close the program it gives SocketException :Connection reset.
    on client side:
    My request is just a string
    on the server side:
    I check the string and give the client what it wants.
    I want to know if there's any other way to send requests other than passing it as a string.
    I can post my code if needed.
    thanks,
    Sree

    Here is my client code,minimized it to the extent possible and it might give some compilation problems since i didn't include all the functions needed but i think you should be able to get an idea if i'm doing something wrong.
    Can give you my server code if needed.
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.Socket;
    import java.net.UnknownHostException;
    import javax.swing.JButton;
    public class Test {
         JButton submit_button;
         JButton view_button;
         Socket client;
          JButton get_submit_button() {
                   if (submit_button == null) {
                        submit_button = new JButton();
                        submit_button.setText("Submit");
                        submit_button.addActionListener(new java.awt.event.ActionListener() {
                             public void actionPerformed(java.awt.event.ActionEvent e) {
                                  send_comments_to_server();
                   return submit_button;
               Socket check_client_connection(){
                   String host = "C001192097";     //server host name
                   if(client == null || client.isClosed()){
                    try {
                         client  = new Socket(host, 4321);
                    }catch (UnknownHostException exception){
                         System.err.println(host + ": unknown host.");
                    catch (IOException exception){
                         System.err.println("I/O error with " + host);
                   return client;
              void send_comments_to_server(){
                    try
                         Socket client = check_client_connection();
                         DataOutputStream output_stream = new DataOutputStream(client.getOutputStream());
                         BufferedReader stream_input = new BufferedReader(new InputStreamReader(client.getInputStream()));
                         String comment_report = "comments";
                         Comments comment = new Comments();
                         User_Data user_data = new User_Data(); //function that returns client details such as host name and stuff
                         String user_info = "User Name: "+user_data.user_name+" "+"Host Name: "+user_data.host_name+" "+"Domain Name: "+ user_data.domain_name;
                         comment.user_info = user_info;
                         comment.summary = comment_report;
                         comment.comments = "passing comments";
                         String report = user_info+" "+comment_report+" ";
                         output_stream.writeBytes(report+"\n");
    //                     output_stream.close();
    //                     stream_input.close();
    //                     client.close();
                    }catch(IOException e){
                         e.printStackTrace();
              void receive_comments_from_server(){
                   String line;
                   StringBuffer comments = new StringBuffer();
                   try
                         Socket client = check_client_connection();
                         DataOutputStream output_stream = new DataOutputStream(client.getOutputStream());
                         BufferedReader stream_input = new BufferedReader(new InputStreamReader(client.getInputStream()));
                         String msg = "view comments";
                         output_stream.writeBytes(msg);
                         System.out.println("waiting for response");
                             while((line = stream_input.readLine()) != null){
                                  comments.append(line);
                              System.out.println("Comments from server "+comments);     
                        } catch (IOException e) {
                             e.printStackTrace();
              JButton get_view_button() {
                   if (view_button == null) {
                        view_button = new JButton();
                        view_button.setText("View Comments");
                        view_button.addActionListener(new java.awt.event.ActionListener() {
                             public void actionPerformed(java.awt.event.ActionEvent e) {
                                  System.out.println("request sent");
                                  receive_comments_from_server();
                   return view_button;
    }thanks
    Sree

  • How to enable Sql Dependency OnDataChange event to handle multiple request at a time

    when we work with sql dependency then we work with OnDataChange event and this event notify us regarding data change in table. suppose my application monitor a
    test table by using sql dependency. suppose huge number of data is getting insert and updated in
    test table very frequently. so i do not know how sql dependency
    OnDataChange event can handle this situation because OnDataChange event will fire as many as time data will be change in db table.
    here is my snip for onchange event
    void OnDataChange(object sender, SqlNotificationEventArgs e)
    ((SqlDependency)sender).OnChange -= OnDataChange;
    BBALogger.Write("PartIndexer Service RegisterNotification called end", BBALogger.MsgType.Info);
    if (e.Source == SqlNotificationSource.Timeout)
    MailSend(); // notification mail send
    BBALogger.Write("PartIndexer Service SqlNotificationSource.Timeout error", BBALogger.MsgType.Error);
    Environment.Exit(1);
    else if (e.Source != SqlNotificationSource.Data)
    MailSend(); // notification mail send
    BBALogger.Write("PartIndexer Service SqlNotificationSource.Data", BBALogger.MsgType.Error);
    Environment.Exit(1);
    else if (e.Type == SqlNotificationType.Change)
    StartIndex();
    BBALogger.Write("PartIndexer Service Data changed", BBALogger.MsgType.Info);
    else
    BBALogger.Write(string.Format("Ignored change notification {0}/{1} ({2})", e.Type, e.Info, e.Source), BBALogger.MsgType.Warnings);
    RegisterNotification();
    please help me to design my OnDataChange event such was if data is changed very frequently in test table then
    OnDataChange can handle the situation. OnDataChange event should not be freeze and can log each data change in xml file.
    i am just looking for guidance like how to design OnDataChange as a result it could handle and log data when huge number of user will change data in test table frequently. thanks

    Hi,
    You should be able to delete all nodes selected by an XPath expression... Have a look at this...
    http://docs.oracle.com/cd/E28280_01/dev.1111/e15866/ui_ref.htm#i1290003
    Cheers,
    Vlad

  • Servlets handle multiple, concurrent requests

    Hi, folks. Could someone give me a basic idea of how Servlets handle multiple, concurrent requests which are sent from user's web browser, or possibly, point me some useful web links, tutorials. Let me take a example to make sure that i have explained the question clearly: let's say there is a website that does air ticket booking service. Suppose there is a spare seat exists for a particular flight. There are two users logon to the website and they are both looking for this particular seat. So, once these user's HTML form requests are sent to server, how do i implement my servlet to handle these requests properly, in another words, make sure this seat is only allowed booked by a single user. thanks in advance.

    This acturally raises me a another question which i
    still have some uncertainties. In another assignment i
    did last semester, that was we had multiple users
    using our database and accessing, retirving and
    updating database by using jdbc. And what i did was
    let every user call a particular method within a
    javabean for setting up database connection, then goes
    for the specific that needs to be dealt with. So, what
    i am wondering now is that can i possibly having a
    different approach, like setting up only a single
    connection(ie. a public Connection objec) which being
    exist all the time so that all request can get
    connection by calling this object's relevant method.
    Hope i explained it clearly.
    If I understand you correctly, then you would have to make the methods of this Connecting Object synchronized so that there was only ever one connection to the database at any one time.
    If a database is transactional, that means it has attempted to deal with the problem of multiple connections and statements being executed at the same time on the same data. If you have one single Connecting Object then you don't have to worry about transactions, but you do need to make sure that there aren't multiple threads running, each trying to use your Connecting Object.
    The synchronized keyword makes sure only one thread can use the synchronized method at any one time.

  • How to create/design a servcie request screen to handle multiple sets of request details ?

    Hi All,
    There is a business requirement to create a service request template to handle user account creation requests for a specific application. The inputs for this request is user name and email ID. The account creation requests are made by the dept managers. Most of the time the dept managers make multiple account creation requests at the same time.
    I have already created a service request screen that has "Username" and "Email ID" as input fields . But the problem with this design is for every single account a new service request need to be raised. 
    I want to redesign the service request screen so that it can handle multiple user account requests with a single service request. The number of users for each request varies.
    Is there a way to dynamicaly add multiple input field sets (User name and Email ID),  when creating a new service request ? or Is there any other way to achive this requirement ?
    Thanks.

    Could it be that those users you are asking permission for with this particular service request already exist in VSM system (as an example when VSM is integrated with AD)? If yes, then you can use custom Multiple Value QD [of the Person entity] to select required persons and add as many persons as you like to your request.
    Otherwise it may require deeper analysis of your business requirements. For now I have only some ideas to use Service Actions or custom javascript to create more advanced customer portal interface.
    In this case I would suggest to contact Alemba PSO for an extra service if possible.
    Regs, Gytis

  • Handling multiple submits in single form with JSP

    HI,
    I need to handle multiple submits in single form in a JSP.
    <html>
    <body>
    <form action="/Compute" method="post">
    <input type = "Submit" value="Find"/>
    <input type = "Submit" value="Add"/>
    <input type = "Submit" value="Delete"/>
    </form>
    <body>
    <html>
    /Compute wld take the control to a servlet named ComputeController.java .
    In this servlet how should I distinguish which Submit has been clicked(Find or add or Delete).
    TIA

    Give the submit button a name. It will be sent as well, so you can see it in the request variables.

  • Mult request in servlet

    hi there;
    <p>
    currently, i am using servlet to do payment and display the customer information after processing.
    <p>
    in SERVLET doGet() it will do request.getParameters() and gen random session ID. i set all the var to a object called LOG. sometime, they might have > 1 user connect in concurrently. so, i designed to spawn a thread for handling multi request coming in at the same time. i pass this LOG obj when spawning a thread. inside the THREAD will have few method to do the processsing and also getting information from db. after that, i set the final result to replace the LOG object.
    <p>
    now, how am i suppose to pass the LOG object from THREAD back to the SERVLET? as i need to print the information like ID, name, etc on the servlet page?
    <P>
    10;
    yoke yew

    erm.... why so complicated?
    What outdated servlet container are you using that it doesn't handle multiple concurrent requests already?
    And if you do have an up to date container, why the heck are you doing this thread stuff?
    The default handling for a servlet IS to have multiple threads running through it (unless you explicitly tell it not to) Let the container handle it - its better in the long run.

Maybe you are looking for

  • How can I determine if my iMac is infected with Malware.  Internet is very slow at times.

    Some time ago I opened a link in an email from a friend and later found out that his email address had been hijacked.  The site the link took me to seemed innocuous, but ever since it seems that from time to time that my internet connection is very s

  • Airport Extreme with Airport USB Disk issues - Dont give up just yet...

    Just a heads up for anyone who is having issues with accessing an Airport disk with the latest firmware. After calling Apple support as i was convinced my AEBS was faulty, i have since discovered that if and HFS+ disk cannot be varified and repaired

  • Problem with simbl_ps plugin

    I seldom use Safari, but occasionally I run into an application update that's defaulted to Safari (v5.1 running in Lion).  I receive an error message stating that the SIMBL_PS plugin was not installed because it hasn't been tested with Safari 5.1.  I

  • 4 playlists on iTunes/PC; only 2 will synch

    I have four playlists in iTunes and only two will synch. First I just did a regular synch, the 2 showed up. Then I clicked the songs in the other 2 playlists and ran a synch for checked items. My previously synched playlists disappeared and the other

  • Reset SAP GUI passwords for number of users

    Dear, i need your help in how to Reset SAP GUI passwords for number of users one time, as we have non-SAP users, only ESS users that they are currently using Portal ESS, but we need to reset thier GUI passwords so that they will not be accessing the