Servlet-Applet project. Architectural problem.

Hello, everybody!
I'm to make client-server web project, client works with different databases via server (using servlet). The protocol of the project is as follows:
- Client requests to �erver and gets applet.
- All communications between client and server are to be made via applet-servlet. So, client makes some operations using applet, then sends data to server. After the data being processed on the server side, client gets the possibilities to make further operations.
The problem is choosing the proper architecture. Having sigle applet and processing communications with single applet-servlet is not good, because I need to get client the possibility to choose database, then choose table, edit records and so on. I want to have applets for every type of operations. I mean, after client gets start applet, he sends the request to server, which processes it and gets another applet for database choosing and so on.
The question is: is it possible to build such architecture with many applets and data transfers between them?

Why does it need to be through applet?
Why can't the same applet take care of most (all?) your database chores?

Similar Messages

  • Servlet Applet object communication problem???!!!

    Hy folks,
    I need to validate the ability of complex Servlet Applet communication an run into my first pb right at the beginning of my tests. I need to have around 200 Applet clients connect to my servlet and communicate by ObjectInput and ObjectOutput streams. So I wrote a simple Servlet accepting HTTP POST connections that return a Java object. When the java Applet get instantiated, the Object Stream communication workes fine. But when the Applet tries to communicate with the servlet after that, I can not create another communication session with that Servlet, instead I get a 405 Method not allowed exception.
    Summarized:
    - Applet init() instantiate URLConnection with Servlet and request Java object (opening ObjectInput and Output Stream, after receaving object, cloasing streams).
    - When I press a "get More" button on my Applet, I am not able to instantiate a new URLConnection with my servler because of that 405 exception, WHY???
    Here my Servlet code:
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
             ObjectInputStream inputFromApplet = null;
             ArrayList transmitContent = null;       
             PrintWriter out = null;
             BufferedReader inTest = null;
             try{               
                   inputFromApplet = new ObjectInputStream(request.getInputStream());           
                     transmitContent = (ArrayList) inputFromApplet.readObject();       
                     inputFromApplet.close();
                     ArrayList toReturn = new ArrayList();                 
                     toReturn.add("One");
                     toReturn.add("Two");
                     toReturn.add("Three");
                     sendAnsweredList(response, toReturn);                 
             catch(Exception e){}        
         public void sendAnsweredList(HttpServletResponse response, ArrayList returnObject){
             ObjectOutputStream outputToApplet;    
              try{
                  outputToApplet = new ObjectOutputStream(response.getOutputStream());          
                  outputToApplet.writeObject(returnObject);
                  outputToApplet.flush();           
                  outputToApplet.close();              
              catch (IOException e){
                     e.printStackTrace();
    }Here my Applet code:
    public void init() {         
             moreStuff.addActionListener(new ActionListener(){
                  public void actionPerformed(ActionEvent e){
                       requestMore();
             try{
                  studentDBservlet = new URL("http://localhost/DBHandlerServlet");              
                  servletConnection = studentDBservlet.openConnection();      
                   servletConnection.setUseCaches (false);
                   servletConnection.setDefaultUseCaches(false);
                   servletConnection.setDoOutput(true);
                   servletConnection.setDoInput(true);
                   ObjectOutputStream outputToApplet;
                 outputToApplet = new ObjectOutputStream(servletConnection.getOutputStream());          
                 outputToApplet.writeObject(new ArrayList());
                 outputToApplet.flush();           
                 outputToApplet.close(); 
                   ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
                   ArrayList studentVector = (ArrayList) inputFromServlet.readObject();
                   area.setText("Success!\n");
                   for (int i = 0; i<studentVector.size(); i++) {
                        area.append(studentVector.get(i).toString()+"\n");
                  inputFromServlet.close();
                  outputToApplet.close();             
              catch(Exception e){
                   area = new JTextArea();
                   area.setText("An error occured!!!\n");
                   area.append(e.getMessage());
            getContentPane().add(new JScrollPane(area), BorderLayout.CENTER);
            getContentPane().add(moreStuff, BorderLayout.SOUTH);
        private void requestMore(){
             try{              
                  studentDBservlet = new URL("http://localhost/DBHandlerServlet");                             
                  servletConnection = studentDBservlet.openConnection(); 
                   ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
                   ArrayList studentVector = (ArrayList) inputFromServlet.readObject();
                   area.setText("Success2!\n");
                   for (int i = 0; i<studentVector.size(); i++) {
                        area.append(studentVector.get(i).toString()+"\n");
              catch(Exception e){               
                   area.setText("An error occured2!!!\n");
                   area.append(e.getMessage());
        }Can someone help me solv this issue please, this is my first Applet Servlet work so far so I have no idea on how to solve this issue.

    Sorry folks, just found my error. Forgot about the ObjectInputStream waiting on the Servlet side, so of course had a dead look...
    Sorry!

  • Servlet/Applet communication, data limit?

    I have an applet that uses a servlet as a proxy to load/retrieve images from an Oracle database. I have a problem when trying to retrieve images larger than 9-10kb from the database. When using JDBC from a Java Application I don't have any probelms but through the Applet-Servlet configuration I do.
    I use the following code in the Applet:
    URL url =new URL("http","myserver",myport,"/servlet/MyServlet");
    HttpURLConnection imageServletConn = (HttpURLConnection)url.openConnection();
    imageServletConn.setDoInput(true);
              imageServletConn.setDoOutput(true);
              imageServletConn.setUseCaches(false);
    imageServletConn.setDefaultUseCaches (false);
    imageServletConn.setRequestMethod("GET");
    byte buf[] = new byte[imageServletConn.getContentLength()];
    BufferedInputStream instr = new BufferedInputStream(imageServletConn.getInputStream());
    instr.read(buf);
    Image image = Toolkit.getDefaultToolkit().createImage(buf);
    // then code to display the image
    And the following for the Servlet:
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("image/gif");
    byte[] buff = loadImage(); // this method returns a byte array representing the image.
    response.setContentLength(contentLength);//contentLength is the size of the image
    OutputStream os = response.getOutputStream();
    os.write(buff);
    os.close();
    thanks in advance!

    thanks for your replay,
    I tried your suggestion but whatever I do it seems that tha applet only brings the first 5-10k of the image from the servlet. This is the value I get from instr.read() or any other type of read method. The value of bytes is not always the same.
    Now I also have something new. For images greater than 100k or so I get this error:
    java.io.IOException: Broken pipe
         at java.net.SocketOutputStream.socketWrite(Native Method)
         at java.net.SocketOutputStream.socketWrite(Compiled Code)
         at java.net.SocketOutputStream.write(Compiled Code)
         at java.io.BufferedOutputStream.write(Compiled Code)
         at org.apache.jserv.JServConnection$JServOutputStream.write(Compiled Code)
         at java.io.BufferedOutputStream.write(Compiled Code)
         at java.io.FilterOutputStream.write(Compiled Code)
         at interorient.DBProxyServlet.doGet(Compiled Code)
         at javax.servlet.http.HttpServlet.service(Compiled Code)
         at javax.servlet.http.HttpServlet.service(Compiled Code)
         at org.apache.jserv.JServConnection.processRequest(Compiled Code)
         at org.apache.jserv.JServConnection.run(Compiled Code)
         at java.lang.Thread.run(Compiled Code)
    I am using the Oracle Internet application server (ias 9i) which actualy uses the apache web listener.
    It seems that this servlet-applet communication is really unstable. If you have anything that may help me it will be greatly appriciated. You can even e-mail me at [email protected]
    thanks!

  • BW project Architecture

    Hi
    Can anybody explain about
    1) what is the BW project Architecture?
    2) What is the project landscape?
    please forward documentation on these topics [email protected]
    thanks in advance
    dj

    Hi,
    BW architecture:
    http://help.sap.com/saphelp_nw04/helpdata/en/f7/8e93e8850b244085f2c4a39a7d73d5/frameset.htm
    Landscape:
    https://www.sdn.sap.com/sdn/developerareas/bi.sdn?contenttype=url&content=/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/documents/a1-8-4/enterprise data warehousing with sap bw - an overview
    You can also look at:
    Re: Landscape
    assign points if useful ***
    Thanks,
    Raj

  • Java Project Architecture

    can any body give me the project architecture in CMM Level companies?Does they are follwing any specific rules to frame this architecture?
    Thanks in Advance
    Srinivasa Rao Somu
    Software Engineer
    Netsoft Global Informatica Pvt ltd.
    [email protected]

    The purpose of the Capability Maturity Model (CMM) is to measure the software development "process" of an organization.
    The CMM is used as a guide to determine how mature an organization is in regards to their software process. It is based on process improvement.
    It does not measure software development, it measures the "processes" within the organization. Examples of metrics include training, documentation, staff meetings, testing, quality assurance, project management, and contracting procedures.
    It is typically used when contracting is involved, and for high-level software systems found in military, airline, automobile, and medical equipment industries.
    CMM is dated. The current model is CMMI.
    Organizations that produce software are measured using the CMMI model. The measurement is then certified by the SEI.
    If an organization has a high CMMI rating, it can advertise it's rating and services and submit bids for contracts.
    If an organization has a low CMMI rating, it can use the results of the measurement for improving its processes and identifying problem areas.
    CMMI assessments are executed by certified individuals. If you are interested in having your staff certified, you must send them to the training courses at SEI.
    If you are interested in having your organization measured with the CMMI, you must contact the SEI and submit a request.

  • Project Architecture

    Hi..
    I am now hunting for job in Java..
    What does really a project architecture mean, while we are developing a project using JSP,Servlet and Struts . What a project flow diagram. Does both are almost same or different. What should be the answer of the question..(What is the architecture of your project ?) .
    Plz help me out !

    I guess the answer is something including the next explanations:
    - Develop language (Jave, in this case)
    - Kind of application (stand alone / web)
    If web application:
    - Web application server (Tomcat, Websphere, BEA Weblocig, etc.)
    - Developing technology: Struts (framework implementing MVC pattern), JSP (View), ActionServlet (Controller), JavaBeans-EJB (Model), etc.
    - Persistence: Hibernate (or other object persistence implementation) or DB access with SQL code embedded in Java code.

  • Project architecture question

    hello
    iam trying to develop a mobile application using j2me to communicate with linux machine through wireless LAN .
    my question is that iam confused about the project architecture.
    ihave 2 ways:
    1-develope desktop application working as aserver (on the linux machine) and the communication with mobile through streams.
    OR
    2-make the server is tomcat running my developed servlet and the communication through HTTP.
    which way is prefered and why? or any other suggestions?
    thanks in advanced.

    HTTP is perfered because it is more widely supported.

  • Is there any JSP/servlet opensource project like phpMyAdmin?

    Is there any JSP/servlet opensource project existed which is designed to manipulate the database MySQL such as phpMyAdmin?
    I would like to gain the source code and reference to its design pattern.

    I don't know about PHPMYAdmin but MySqlAdmin can do any job you need
    http://www.skillipedia.com

  • Re: Error retrieving cache in c# WPF project (No problems in c# WinForms)

    Originally resurrected a long-dead post from 2011 and attempted to hijack it away from the original poster,
    Error retrieving cache in c# WPF project (No problems in c# WinForms)
    but got my inquiry split away to let it stand on its own merits...
    My question is:
    Wondering if anyone could answer... The setup is the same (XP SP3, Coherence 3.7.1.0). GetValues(null) returns different number of values every time.
    More information: the serialized type has just one string property X; push 40000 such items into cache, then making GetKeys(null) followed by GetValues(null) call with 1 sec interval (cache is pre-populated with 40000 items, no insertions/deletions happening):
    Keys 40000, Values 20377.
    Cache is just one storage enabled proxy with schema taken from Coherence example configuration.
    I understand, calling GetValues with null argument is not the smartest thing to do, but the problem is that it affects the number of items returned by the GetValues with a filter passed...

    Hi Thiago V Palmeir,
    Thank you for your response.
    Your problem seems to be about the list of projects in JDeveloper when there are many projects..
    My problem is very different because I have only 3 projects in the application and the problem occurs when deploying to manually added Integrated Web Logic Installation with the domain that I created (not the DefaultDomain created by JDeveloper)..
    In any case, I tried to delete system11.1.1.5.37.60.13, start JDeveloper, and it re-creates the folder. I then re-create the additional IntegratedWebLogic server instance in the application server navigator and try to run my application using that instance of integrated web logic.
    The error still happens.
    Regards,
    Arief

  • Applet - Servlet - Database - Servlet- Applet

    Hi All,
    I am using Oracle8i and IE 5.0. I am trying to retrieve the data from a db table and display it.
    Sequence is as following:
    1. Query passed to the applet.
    2. Servlet excutes this query using JDBC and returns the resultset to applet.
    3. Applet displaysthe results.
    Is there anybody who has a code sample to do this, my id is [email protected] ? I am totally new to java and servlets. I would really appreciate any help.
    Thanks a lot.
    Manuriti
    [email protected]

    I've never dealt with the code to handle the applet portion of what you're trying to do, but I can help you with the servlet stuff.
    Your servlet should contain code to accomplish the following steps:
    1. Load an Oracle JDBC driver into memory.
    2. Open a JDBC connection to the Oracle database.
    3. Create a JDBC Statement object which contains the appropriate Oracle SQL code.
    4. Execute the Statement object, which will return a ResultSet.
    5. Read the ResultSet data.
    6. Pool or close the Statement and Connection objects.
    All of these steps are simple. Here's what they might look like in practice:
    // load the Oracle driver
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // open the connection
    String cs = "jdbc:oracle:[email protected]:1521:DBNAME"; // connection string
    String userName = "scott";
    String password = "tiger";
    Connection con = DriverManager.getConnection(cs, userName, password);
    // create a Statement object
    Statement stmt = con.createStatement();
    // create a ResultSet object
    ResultSet rs = stmt.executeQuery("select * from DUAL"); // your SQL here
    // INSERT CODE HERE TO READ DATA FROM THE RESULTSET
    // close the Statement object
    stmt.close();
    // close the Connection object
    con.close();
    So that's how you get data from your Oracle database. Now, how do you pass it to your applet? Well, this is hardly trivial. Typically, servlets return an HTML-formatted text stream. It is possible to have an applet communicate with a servlet, but that raises security issues that I don't fully understand. I believe you would have to have your user's browsers set to the lowest possible security settings, otherwise the browser won't let the applet open a socket to a foreign IP, but again, I'm shaky on that one.
    Anywho, let me know if this was of help and if you have more questions on the servlet/applet stuff. I can probably help you with more specific questions,.

  • Project architecture in Oracle SOA Suite.

    Hi,
    Could any one please provide the info abt " How the Project Architecture is implemented and its steps in realtime in Oracle SOA suite 10g/11g ".
    Thanks in advance,
    Venu

    Did you mean Project Structure ?
    If yes, take a look at the following chapter in developer's guide.
    http://docs.oracle.com/cd/E12839_01/integration.1111/e10224/fod_intro2.htm
    Thanks,
    Navaneeth

  • Servlet/applet problem

    hi guys
    my problem is that, i started my tomcat server, also my servlet. this servlet should call an applet. so here are my questions:
    where must be the applet class file?
    how looks like my codebase?
    what code must i type into the servlet? something special?
    do i need an apache server additional?
    yes? where must be my files? :)
    hope anyone can help me...
    bye

    keep the applet class file in the home directory, the directory in which your index.html lies, index.html -- the html which shows up when you say http://localhost:8080
    and then give the applet description like this in the servlet
    out.println("<applet code=\"myApplet.class\" codebase=\"http://localhost:8080\" width=\"400\" height=\"400\"> ");
    out.println("</applet>");
    and that should work and you will be good to go

  • Applet-servlet communication, object serialization, problem

    hi,
    I encountered a problem with tomcat 5.5. Grazing the whole web i didn't find any solution (some guys are having the same problem but they also got no useful hint up to now). The problem is as follows:
    I try to build an applet-servlet communication using serialized objects. In my test scenario i write a serialized standard java object (e.g. a String object) onto the ObjectOutputStream of the applet/test-application (it doesn't matters wheter to use the first or the latter one for test cases) and the doPost method of the servlet reads the object from the ObjectInputStream. That works fine. But if i use customized objects (which should also work fine) the same code produces an classnotfound exception. When i try to read and cast the object:
    TestMessage e = (TestMessage)objin.readObject();
    java.lang.ClassNotFoundException: TestMessage
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    ...That seems strange to me, because if i instantiate an object of the same customized class (TestMessage) in the servlet code, the webappclassloader doesn't have any problems loading and handling the class and the code works fine!
    The class is located in the web-inf/classes directory of the application. I've already tried to put the class (with and without the package structure) into the common/classes and server/classes directory, but the exception stays the same (I've also tried to build a jar and put it in the appropriate lib directories).
    I've also tried to catch a Throwable object in order to get information on the cause. But i get a "null" value (the docu says, that this will may be caused by an unknown error).
    I've also inspected the log files intensively. But they gave me no hint. Until now I've spend a lot of time on searching and messing around but i always get this classnotfound exception.
    I hope this is the right place to post this problem and i hope that there is anyone out there who can give me some hint on solving this problem.
    Kindly regards,
    Daniel

    hi, thanks for the reply,
    all my classes are in the web-inf/classes of the web-app and have an appropriate package structure. thus the TestMessage class is inside a package.
    i tried some names for the testclass but it didn't matter. the exception stays the same. I also tried to put the jar in the common/lib but the problem stays.
    Well the problem with loaded classes: As i mentioned in the post above i can instantiate an object of TestMessage in the code without any problems (so the classloader of my webapp should know the class!!)
    only when reading from the objectinputstream the classloader doesn't seem to know the class?? maybe theres a parent classloader resposible for that and doesn't know the class?
    strange behaviour...
    p.s. sending the same object from the servlet to the client works well
    regards
    daniel
    Message was edited by:
    theazazel

  • Servlet/applet/socket problem

    Hi there,
    my problem is this...
    i create a page with an servlet whicht shows an applet. this applet connects to a server through an socket. it works fine, but, when i change the page and the applet is not longer on the screen, the socket connection will be not killed! i dont know why. but i must kill it when the applet is not longer on the screen...whats wrong? can you help me?
    matthias

    Are you overriding the destroy() method in your Applet? This will be called when the applet is about to be unloaded from the browser. Or, as a slightly different alternative, you can override the stop() method, which is called when the applet is scrolled off the screen. Usually when stop() is used, start() is overriden as well to allow the applet to resume when it is scrolled back into view. For more info, read up on the applet lifecycle.

  • Multiple instances of the same applet loaded causes problem

    I have a java applet that has several classes in the project. The applet has a JTable a JButton and a JLabel control. The applet is displayed within an HTML page. The problem is that if a user opens the same html page more than once with the applet in it, only the last applet loaded receives the screen updates.
    For example in one senario. I have an error message that displays in the Label control once they click on the button.
    The user opens the html page and the applet is loaded (window 1). The user then opens the same html page again (window 2) with window 1 still open. If the user clicks on the Button in window 1, the error message is displayed in the window 2 applet.
    Originally I had some static variables. Thinking it was being used globally by the JVM so I removed all of them and it still happens. I have tried using both the Applet and Object tag. But it still happens.
    Has anyone experienced this before? Any suggestions on how to make the applet update the instance that recieved the events and not just the last one that was loaded?

    You need to look at applet classloader issues. If applets have the same archive list and come from the same codebase, they have the same classloader. A class is namespaced by it's class + classloader. Any statics in a class with a classloader will be shared. If you instead make it such that your applets have unique classloaders (which you can't change for unsigned applets by yourself) by changing the codebase, that would be one solution.
    For other solutions, I recommend searching the forum. This issue comes up a lot.

Maybe you are looking for

  • How to set the 'text' property of a 'Header' region dynamically?

    Hi, I have a requirement to display the 'text' property of a 'Header' region, based on a query. So I need to set the text property programatically in CO. Can I use setText("..") by getting the handler to the 'Header' region? If so, How to get the han

  • Horizontal line going through the screen on retina display

    The line is from right to left as pictured. It only shows up on certain colors, but it gets very annoying with any movie playing. On dark blue and burgundy  backgrounds the line is a black color. Any help would be much appreciated. Thank you

  • IPhoto 11 upgrade trashed my library

    While upgrading iPhoto 11 to version 9.4, the upgrade would complete about 75%, then cause my iMac to reboot.  After several attempts the upgrade completed.  However, my iPhoto library is gone.  When I start iPhoto it prompts for a library name, or t

  • Converting MOV files to AVI

    I bought Quicktime pro 7 for windows to convert mov files to avi files so I can import them into Sony Vegas. But after converting the mov files...vegas still won't recognize the AVI file that was converted by Quicktime Pro. So after doing research on

  • How To capture ScreenShot in C3-01

    Hi Please help me for capturing screenshot in C3-01. Is there any application for doing this? Solved! Go to Solution.