Applet communication with struts servlet

Hi
I�ve seen a lot of examples where a Java applet communicates with a servlet.
I�ve made a web application using Struts, and i would like to know if it is possible to use an applet (View) and send to Stuts some data, I mean, call an action like http://localhost:8080/ViewRoads.do.
Is it possible? ,Where can I find some examples about?, could anyone explain how would it work?, any good book to read about?.
Thank you.

I'm sorry but don't you have a communication source code example between a servlet and an applet that does work ? I'm looking for one of these since Two days already.
thanks

Similar Messages

  • How can I use URLConnection to use applet communication with servlet?

    I want to send a String to a servlet in applet.I now use URLConnection to communicat between applet and servlet.
    ====================the applet code below=========================
    import java.io.*;
    import java.applet.Applet;
    import java.awt.*;
    import java.net.*;
    //I have tested that in applet get data from servlet is OK!
    //Still I will change to test in applet post data to a servlet.
    public class TestDataStreamApplet extends Applet
    String response;
    String baseurl;
    double percentUsed;
    String total;
    public void init()
    try
    java.net.URL url = new java.net.URL(getDocumentBase(),"/servlet/dataStreamEcho");
    //String currenturl=new String("http://lib.nju.edu.cn");
    java.net.URLConnection con = url.openConnection();
    //URL currentPage=getCodeBase();
    // String protocol=currentPage.getProtocol();
    // String host=currentPage.getHost();
    //int port=currentPage.getPort();
    // String urlSuffix="/servlet/dataStreamEcho";
    // URL url=new URL(protocol,host,port,urlSuffix);
    // URLConnection con=url.openConnection();
    con.setUseCaches(false);
    con.setDoOutput(true);
    con.setDoInput(true);
    ByteArrayOutputStream byteout = new ByteArrayOutputStream();
    PrintWriter out=new PrintWriter(byteout,true);
    String currenturl=new String("http://lib.nju.edu.cn");
    String var1=this.encodedValue(currenturl); //encode the data
    String data="currenturl="+var1;
    out.print(data);
    out.flush();
    con.setRequestProperty("Content-Length",String.valueOf(byteout.size()));
    con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
    byteout.writeTo(con.getOutputStream());
    BufferedReader in=new BufferedReader(new InputStreamReader(con.getInputStream()));
    String line;
    while((line=in.readLine())!=null)
         System.out.println(line);
    catch (Exception e)
    e.printStackTrace();
    private String encodedValue(String rawValue)
         return(URLEncoder.encode(rawValue));
    =========================The servlet code below=====================
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class DataStreamEcho extends HttpServlet
    {public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
          res.setContentType("text/plain");
          PrintWriter out = res.getWriter();
          Runtime rt = Runtime.getRuntime();
          out.println(rt.freeMemory());
          out.println(rt.totalMemory());
          response.setContentType("text/html; charset=GBK");     
          request.setCharacterEncoding("GBK");
          PrintWriter out = response.getWriter();
          HttpSession session=request.getSession();
          ServletContext application=this.getServletContext();
          String currenturl=(String)session.getAttribute("currenturl");
          out.print(currenturl);
    =============================================================
    I have done up,but I found the program don't run as I have thought.
    Can you help me to find where is wrong?Very thank!

    You are trying to pass the current URL to the servlet
    from the applet, right?
    Well, what I put was correct. Your servlet code is
    trying to read some information from session data.
    request.getInputStream() is not the IP address of
    anything...see
    http://java.sun.com/products/servlet/2.2/javadoc/javax
    servlet/ServletRequest.html#getInputStream()
    Please read
    http://www.j-nine.com/pubs/applet2servlet/Applet2Servle
    .htmlNo,you all don't understand I.
    I want to send an Object to the server from a applet on a client.not url only.I maybe want to send a JPEG file instead.
    All I want is how to communicate with a servlet from an applet,send message to servlet from client's applet.
    for example,Now I have a method get the desktop picture of my client .and I want to send it to a server with a servlet to done it.How can I write the applet and servlet program?
    Now my program is down,But can only do string,can't not done Object yet.Can anyone help me?
    =======================applet=============================
    public void init()
    try
    java.net.URL url = new java.net.URL(getDocumentBase(),"/servlet/dataStreamEcho");
    //String currenturl=new String("http://lib.nju.edu.cn");
    java.net.URLConnection con = url.openConnection();
    //URL currentPage=getCodeBase();
    // String protocol=currentPage.getProtocol();
    // String host=currentPage.getHost();
    //int port=currentPage.getPort();
    // String urlSuffix="/servlet/dataStreamEcho";
    // URL url=new URL(protocol,host,port,urlSuffix);
    // URLConnection con=url.openConnection();
    con.setUseCaches(false);
    con.setDoOutput(true);
    con.setDoInput(true);
    ByteArrayOutputStream byteout = new ByteArrayOutputStream();
    PrintWriter out=new PrintWriter(byteout,true);
    String currenturl=new String("http://lib.nju.edu.cn");
    String var1=this.encodedValue(currenturl); //encode the data
    String data="currenturl="+var1;
    out.print(data);
    out.flush();
    con.setRequestProperty("Content-Length",String.valueOf(byteout.size()));
    con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
    byteout.writeTo(con.getOutputStream());
    con.connect();
    BufferedReader in=new BufferedReader(new InputStreamReader(con.getInputStream()));
    String line;
    while((line=in.readLine())!=null)
         System.out.println(line);
    catch (Exception e)
    e.printStackTrace();
    =======================servlet=============================
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         response.setContentType("text/html; charset=GBK");
    //request.setCharacterEncoding("GBK");
    PrintWriter out = response.getWriter();
    HttpSession session=request.getSession();
    ServletContext application=this.getServletContext();
    //String currenturl=(String)session.getAttribute("currenturl");
    String currenturl=(String)request.getParameter("currenturl");
    out.print(currenturl);
    File fileName=new File("c:\\noname.txt");
    fileName.createNewFile();
    FileOutputStream f=new FileOutputStream(fileName); //I just write the String data get from
    //applet to a file for a test.
    byte[] b=currenturl.getBytes();
    f.write(b);
    f.close();
    }

  • Applet communication with DLL

    Hi,
    Can an applet communicate with Microsoft DLL.
    I want to save the content of an applet to database at server side.
    Problem is there is no java envirnoment at server side (it has dlls).
    What is the best way to do this. The content of the applet has to be savea at sever side not at client.
    Thanx

    deepakshettyk,
    Two options that come to mind are:
    1) have the applet use JDBC to connect to its host server's database directly. Typically this entails having type4 JDBC drivers installed and available.
    2) have the applet itself connect back to its host server's webserver (IIS?), and have a server-side agent (ASP?) record data sent back to a database. See Marty Hall's book, 'Servlets & JSP', from Prentice Hall, for code examples.
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Doubt about applet communicating with the SIM

    Greetings,
    I have this doubt: I am developing a web site which contains a java applet. The web site is going to be available at some web server. The web site is going to be accessed by mobile phones. The idea is that, somehow, the applet communicates with the mobile phone and extract info from the SIM Card for authentication. I still wondering if it is possible and the possible drawbacks or alternatives.
    Thank you in advance,
    Fernando

    Hi,
    you definitely have to sign your applet to do that.
    Check in the forum "Security -> Signed applet". You'll find the information you need to sign an applet.
    For example check at: http://forum.java.sun.com/thread.jsp?forum=63&thread=174214

  • Servlet to applet communication: with out polling

    hi,
    i need to write an applet which captures the realtime data as it appears in the server. Is this possible with out polling ther server at constant intervals? i.e... is it possible for the server to push data to an applet (say applet first registers etc etc with the server)
    One more thing..say applet had opened a connection with server and opened a stream. Now is it possible for it to keep listening over the connection so that server puts the info over the connection when ever it has it and the client displays the info when ever it receives it.
    Any pointers would be helpful.

    [email protected] wrote:
    hi,
    i need to write an applet which captures the realtime data as it appears in the server. Is this possible with out polling ther server at constant intervals? i.e... is it possible for the server to push data to an applet (say applet first registers etc etc with the server)sure it's possible
    One more thing..say applet had opened a connection with server and opened a stream. Now is it possible for it to keep listening over the connection so that server puts the info over the connection when ever it has it and the client displays the info when ever it receives it.
    Any pointers would be helpful.i'm not sure what the best way is, but I've done it with Sockets and ObjectOutputStream

  • Communicating with a Servlet

    How do i send objects from an application to a Servlet so that the servlet can use those objects to check if they exist in a database
    thank you kindly

    Since i cant setup my Servlet engine and check if it works i thought id ask if there are gonna be any problems with this code so i can continue on with my project
    heres the modified Info class
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    public class Info extends JFrame{
         private JLabel user, pass, cpass;
         private JTextField usert;
         private JPasswordField passt, cpasst;
         private Socket s;
         private ObjectOutputStream out;
         public Info(){
              super("Login");
              Container c = getContentPane();
              c.setLayout(new GridLayout(6,1));
              user = new JLabel("Username");
              pass = new JLabel("Password");
              cpass = new JLabel("Confirm Pass");
              usert = new JTextField("ivo");
              passt = new JPasswordField();
              cpasst = new JPasswordField();
              c.add(user);
              c.add(usert);
              c.add(pass);
              c.add(passt);
              c.add(cpass);
              c.add(cpasst);
              try{
                   s = new Socket("127.0.0.1", 3456);
                   out = new ObjectOutputStream(s.getOutputStream());
                   out.writeObject(user.getText());
              }catch(Exception e){
                   e.printStackTrace();
              setSize(200,200);
              show();
         public static void main(String args[]){
              Info app = new Info();
    }and heres the Servlet class
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.net.*;
    public class servlet extends HttpServlet{
    private ServerSocket ss;
    private Socket s;
    private ObjectInputStream in;
    public void init(){
         try{
         ss = new ServerSocket(3456);
         s = ss.accept();
         in = new ObjectInputStream(s.getInputStream());
         System.out.print((String)in.readObject());
    }catch(Exception e){
         e.printStackTrace();
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
         response.setContentType("text/html");
         PrintWriter out;
         out = response.getWriter();
         StringBuffer buf = new StringBuffer();
         buf.append("<HTML><HEAD><TITLE>\n");
         buf.append("My Servlet\n");
         buf.append("</TITLE></HEAD><BODY>\n");
         buf.append("<H3>SUP!!!</H3>");
         buf.append("</BODY></HTML>");
         out.println(buf.toString());
         out.close();
    }thank u in advance

  • Applet connection with a servlet.

    hi all.
    i need to send data from an applet in the client side to a servlet on the server.
    i want to send this data via http so i won't have to get around firewalls and other problems that might come up if i'll use sockets.
    i'm sending objects, like this: (applet side)URL url = new URL("http://localhost:8080/examples/servlet/ImportListener.Listener");
    URLConnection con = url.openConnection();
    con.setUseCaches(false);
    OutputStream out = con.getOutputStream();
    ObjectOutputStream objStream = new ObjectOutputStream(out);
    objStream.writeObject(record);i have two questions:
    (1) how do i get this object data in the servlet??? will it be in the doGet() method?
    (2) how can i send a confirm message back to the applet?
    thanks!

    Hi!
    I have implemented such case, and I thought it might be so helpful for all to post the solution over here, I will provide two cases in one example, first, the applet will send parameters within the posted URL, and in this case you can retrieve them in doGet method, another case is to write objects over output streams, and in this case it will be sent to the servlet using POST method, because the GET method does not have a body which must be exist to handle the streams, so, the whole request will be sent over POST method, and to get it, fill up your Java doPost():
    NOTE: Any object you want to send/retrieve over a network MUST be serializable, which means, the class must implement java.io.Serializable.
    The Applet - CLIENT
    ================
    public boolean getSomeInformation(Object myObject)  {
            // Get a backend connection, see the connect() method below
            URLConnection connection = connect("/myAliasServlet?myname=nabieh&myage=28");
            BufferedReader servletResponse = null;
            ObjectOutputStream oos = null;
            try {
                oos = new ObjectOutputStream(connection.getOutputStream());
                // serialize the object
                oos.writeObject(myObject);
                oos.flush();
                // Read the response from the servlet:
                servletResponse = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String response;
                String s = "";
                while (null != ((response = servletResponse.readLine()))) {
                    s += response;
                if (s != null) {
                    if (s.equals("SUCCESS")) {
                        executed = true;
                    } else {
                         // s = "null"!
                        JOptionPane.showMessageDialog(myForm, s, "Error", JOptionPane.ERROR_MESSAGE);
                        executed = false;
            } catch (IOException ioe) {
                ioe.printStackTrace();
            } finally {
                try {
                    if (oos != null) {
                        oos.close();
                    if (servletResponse != null) {
                        servletResponse.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
            return executed;
    public URLConnection connect(String alias) {
            URLConnection connection = null;
            String serverContext = "http://192.168.0.2:8888/MyApp";
            // Connecting to the server:
            try {
                String s = serverContext + alias;
                URL url = new URL(s);
                connection = url.openConnection();
                connection.setDoInput(true);
                connection.setDoOutput(true);
                connection.setUseCaches(false);
                connection.setRequestProperty("Content-Type", "application/octet-stream");
            } catch (MalformedURLException murle) {
                murle.printStackTrace();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            return connection;
        }The servlet, server side:
    ===================
    Here, the servlet reads the object, do some process whatever it is, pass back a String to the client, the applet.
    protected void doPost(HttpServletRequest request,
                   HttpServletResponse response) throws ServletException, IOException {
                    // Get both passed parameters, myname and myage
                     String name = request.getParameter("myname");
              String age = request.getParameter("myage");
                   // Get the seializable object
              ObjectInputStream ois = new ObjectInputStream(request.getInputStream());
              MyObject mo = null;
              try {
                   mo = (MyObject ) ois.readObject();
              } catch (IOException ioe) {
                   System.out.println(ioe.getMessage());
              } catch (ClassNotFoundException cnfe) {
                   System.out.println(cnfe.getMessage());
              // Do whatever you want over here...
                    String found = doSomeThing(mo); // This method gonna return a string, "SUCCESS" or "null".
                    PrintWriter pw = response.getWriter();
              pw.write(found);
              pw.flush();
              pw.close();
         }Good luck.

  • Standard Java class communicating with a servlet

    Hey,
    I am trying to access a standard java classes member via a servlet class however the data is never received even though the member is visible on compilation. is there something Im doing wrong ?
    public class Start {
    //lots of stuff
         static List<Plug> plugList = Collections.synchronizedList(new LinkedList<Plug>());
    //lots more stuff
    public class wah extends HttpServlet{
            public void doGet( HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
                    doPost(request, response);
        public void doPost(HttpServletRequest request,
                                    HttpServletResponse res)throws ServletException, IOException{
                    res.setContentType("text/html");
                    PrintWriter out = res.getWriter();
                    out.println("wahwahwah");
                    synchronized(Start.plugList){
                            out.println("pluglist");
                            Iterator i1 = Start.plugList.iterator();
                            while (i1.hasNext()) {
                                    Plug oldPlug = (Plug)i1.next();
                                    out.println("PLug : " + oldPlug.getaddress64());
            }//doPost
    }

    Don't post all your code. Instead, make a simplified version of the code that demonstrates what your problem is and that we could compile and see what is going on. Make it as simple as possible but still demonstrating the problem.
    Who knows, when you make the SSCCP (small, self contained, compileable program) you will find your mistake as well.
    But without seeing any code all I can say is that the date you are accessing in the list has not been made available when you try to get it from the servlet. Perhaps the servlet call is blocking the other threads from accessing the list to put data into it, perhaps the other threads haven't begun working yet, perhaps the list you give to the servlet isn't the same list (but instead a copy of the list) that the data is being entered into, or many other reasons.
    One thing I would assume you need to do, since the Servlet is the data consumer, you need to make sure the data has been entered before the servlet tries to read it. The best way to do that is to put a wait() in the servlet code so that it knows it can't do anything until the producers are finished. Then the producers would add a notify() to tell the servlet to go ahead and display the data.
    So some modification might be:
    public class Start {
    //lots of stuff
         static List<Plug> plugList = Collections.synchronizedList(new LinkedList<Plug>());
            //marker to let servlet know that it can consume data
            private static boolean done = false;
            //producers call this method when list is ready for use
            static void setReadyToConsume() { done = true; }
            //servlet calls this to check if the list is ready
            public static boolean isReadyToConsume() { return done; }
    //lots more stuff
        public void doPost(HttpServletRequest request,
                                    HttpServletResponse res)throws ServletException, IOException{
                    res.setContentType("text/html");
                    PrintWriter out = res.getWriter();
                    out.println("wahwahwah");
                    synchronized(Start.plugList){
                           //Hold off trying to use list until list is ready
                            while (!Start.isReadyToConsume()) {
                                  try {
                                          Start.plugList.wait();
                                  } catch (InterruptedException ie) {
                                          log("Waiting for Plugs to be ready interrupted.  Continuing to wait.");
                                          log(ie.getMessage(), ie);
                            out.println("pluglist");
                            Iterator i1 = Start.plugList.iterator();
                            while (i1.hasNext()) {
                                    Plug oldPlug = (Plug)i1.next();
                                    out.println("PLug : " + oldPlug.getaddress64());
            }//doPostAnd don't forget to add a Start.plugList.notify() or Start.plugList().notifyAll() in the producer code after it calls the setReadyToConsume() method.

  • Swing based applet communication with javascript

    Hi
    In my browser based application, the GUI has two part one contains the swing based applet and other is html based text area. Applet contains the list of text files.
    My requirements is that if user double clicks on a file the, text area should display the name or path or content of file. I facing problem at very first level, how to capture the swing event in java script of browser?
    Thanks in advance!!! :)

    Hi
    In my browser based application, the GUI has two part one contains the swing based applet and other is html based text area. Applet contains the list of text files.
    My requirements is that if user double clicks on a file the, text area should display the name or path or content of file. I facing problem at very first level, how to capture the swing event in java script of browser?
    Thanks in advance!!! :)

  • VB Client communicating with a Java servlet

    Hi,
    I have a java servlet and I would like to have a VB application communicating with the servlet.
    Can I do it ? and if yes, how to do it.
    Thanks in anticipation,
    Ayana

    The VB client can open an internet or Http connection to the servelet, send a request and parse the response. We've done it here but I don't know exactly which ActiveX control the VB guy uses.
    Also look into using webservices.

  • Servlet Communication with Java WebStart

    Hi there,
    we have an application that works fine with Java WebStart whenever we start it in a local area network. But from outside the LAN the application cannot communicate to it's servlets. I use the codebase IP address with the servlet runner's port (http://<codebase IP>:port/) as URL for servlet communication, but the application's request never reaches the servlets.
    My question is now, if anyone had the same or a similar problem with servlet communication using Java WebStart, or if anyone knows, if that might be a problem with proxy configuration.
    The servlet runner we use, is JServ from Sun (JSDK2.0) and the webserver where it is running on is not behind a firewall or a proxy, but the client PC with the web start application is.
    Thanks,
    Katja

    Thank you for your early reply. But I think, that's not the problem.
    I get no security error and the webserver is identified the same way it is in the jnlp file. Also my application is not running in the Sandbox. My assumption is, that the http-request to the servlet does not go through the proxy server between my PC and the PC the servletrunner is running on.
    I wonder if I have to configure my application to use a proxy server for communication with the servlets instead of the direct http-request to the servlet runner?

  • Communication with other domain

    Hi,
    An internal application (.exe developed in Delphi) at a
    clients server (
    no webserver) can communicate ( JSON protocol) with other
    applications, also web based.
    While testing the AS2 / AS3 classes ( from
    http://www.json.org ) in the Flash
    IDE (ctrl-enter) their was no problem. I made a connection on a
    static IP-adres with open port and could send/recieve json-objects.
    So far so good.
    When publishing it for a html page, the trouble began. The
    known security problem.
    Is there a solution?
    We don't know where to put the crossdomain.xml because there
    is no root! There is just an application listening to an open port
    on a static IP adres.
    Just a single executable listening to an open port if a
    request is comming in so it can send an answer.
    Is there a solution?
    How does the flash player finds out if a crossdomain.xml is
    avalable?
    Does it send a request also? Is it ok to generate a
    crossdomain.xml on the fly on that request?
    Help us please!

    I think I understood the following:
    - Cards have a special applet called Card Manager (or Security Domain) for example to load and delete other applets
    - Communication with the Card Manager goes over a secure channel with specific keysThat is correct
    Questions:
    - Are these keys 'open' so they can be used for every card of the same type?Development cards generally have know keys that can be used. When you go into production, your cards will have a unique (each card in fact will have its own key)
    - Are these keys set by the factory and maybe reset by a distributor?Both. The card issue can also set the keys before sending the card out. Check the GlobalPlatform Key Management System specification from the GP website for more details on key management.
    WrappedCommand --> 80 CA006600
    Response <-- 664C734A0607...(I'll post all bytes if necessary)...9000Can you provide the full response from the card?
    Can I somehow check if my Card is already blocked (too much failed attempts?) without waisting another attempt?No. If you have exceeded the tries your next INIT UPDATE will fail. You should have 10 per card with the JCOP cards from memory. Some Gemalto cards lock after 5.
    Cheers,
    Shane

  • Not able to run Applet after calling JSP with a Servlet

    Dear Java-Community :)
    At first I want to say, that my English isn't the best.. so I hope you'll understand my problem ;)
    I'm running a J2EE-Application, packed in a EAR-File, on my JBoss with following directory-structur:
    /jaw6c/bin
    /jaw6c/build
    /jaw6c/common
    /jaw6c/ejb
    /jaw6c/sql
    /jaw6c/src
    /jaw6c/webapp
    /jaw6c/webapp/build
    /jaw6c/webapp/build/classes
    /jaw6c/webapp/build/classes/com
    /jaw6c/webapp/build/classes/com/jbossatwork
    /jaw6c/webapp/build/classes/com/jbossatwork/ControllerServlet.class<<<<<<<<
    /jaw6c/webapp/build/distribution
    /jaw6c/webapp/build/distribution/webapp.war
    /jaw6c/webapp/build/gensrc
    /jaw6c/webapp/compile-lib
    /jaw6c/webapp/lib
    /jaw6c/webapp/src
    /jaw6c/webapp/src/com
    /jaw6c/webapp/src/com/jbossatwork
    /jaw6c/webapp/src/com/jbossatwork/ControllerServlet.java
    /jaw6c/webapp/web
    /jaw6c/webapp/web/WEB-INF
    /jaw6c/webapp/web/WEB-INF/classes
    /jaw6c/webapp/web/buyCarForm.jsp
    /jaw6c/webapp/web/carForm.jsp
    /jaw6c/webapp/web/carList.jsp
    /jaw6c/webapp/web/copy_darstellungErgebnisse.jsp
    /jaw6c/webapp/web/darstellungErgebnisse.jsp<<<<<<<<<<<<<<
    /jaw6c/webapp/web/default.css
    /jaw6c/webapp/web/diag.jar
    /jaw6c/webapp/web/diagram.class<<<<<<<<<<<<<<<<<<<<<<<<
    /jaw6c/webapp/web/error.jsp
    /jaw6c/webapp/web/index.jsp
    /jaw6c/webapp/web/selectBewertungslaeufeList.jsp
    /jaw6c/webapp/build.xml
    /jaw6c/build.xmlThe applet should be loaded in my "darstellungErgebnisse.jsp"-File.
    Now the strange situation:
    When I access "darstellungErgebnisse.jsp" DIRECTLY by entering a URL like "localhost:8080/jaw/darstellungErgebnisse.jsp" , the applet is loading perfectly !
    But when my server is forwarding me to the JSP-Site with
    RequestDispatcher dispatcher =  getServletContext().getRequestDispatcher(destinationPage);
    dispatcher.forward(request, response);
    . . . . . . . ..I'll get a ""java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file diagram
    " -Error what means (referenced on the articles I've read here), that the diagram.class Is not found !
    I have tried to put the class file in a JAR, in different locations... using the codebase and archive tag but NOTHING solved my problem.
    So my question:
    Why I'm able to access the JSP-File directly and seeing the applet but after forwarding to the JSP-File via the Servlet, I'm not able to see anything.
    Would appreciate your help
    Thank you and best regards
    Edit:
    1) I'm able to download the diag.jar and diagram.class file from different locations
    2)I recognized, that after using the servlet, my url is changing from
    localhost:8080/jaw
    to
    localhost:8080/jaw/controller
    I tried added the class file to the position, where the controller-class file is, but without sucess.
    3)Opening the class-file with a hex-editor shows me, that
    the first bytes are
    "CAFEBABE0000002E02B9070002010007"
    (http://forum.java.sun.com/thread.jspa?threadID=648990&messageID=3820701)
    Message was edited by:
    Khaled01

    Hello everybody,
    I finaly have found the solution (after 16 hours).
    Like I mentioned before, I recognized (maybe a little to late), that my path is changing when I'm using the servlet :
    localhost:8080/jaw
    to
    localhost:8080/jaw/controller
    (made by url-pattern in my web.xml).
    So when my JSP tries to acces the class file, It's looking at:
    localhost:8080/jaw/controller/applet/diagram.class
    but the file is in:
    localhost:8080/jaw/applet/diagram.class
    So the solution is, to but a codebase-tag in my applet-declaration with following delcaration "basedir="../applet"
    I hope I'll help somebody with the same problems. It took me a day to find out, that the solution was two points and a slash..... lol
    Regards to everybody

  • Communicating with Servlets....

    hi!
    Wat are all the different ways in which the JSP used to communicate with Servlet?
    Thanx,
    Rgds,
    Sasi

    Jsp page communication with Servlets....
    web.xml -- Servlets loaded during application startup
    struts config -- Servlet mapping (w.r.t struts).
    and u can import servlets in jsp and can use it... there are so many possible ways of using servlets coz jsp pages inturn convert into servlets and got executed.....

  • How to deploy servlets with struts in weblogic61sp2 ?

              I success to config a web app with struts framework via welogic61 admin console,but
              I only saw the first page but I cannot sumit to next page. (Of course,it's right
              if I set struts.jar's classpath and web app jar in my system classpath.But it's
              a bad solution.)
              Here is my startWebLogic.cmd:
              @rem set CLASSPATH=%CLASSPATH%;%PLATFORM%\src\lib\struts.jar
              set STARTMODE=false
              My Folder Structure:
              WEB-INF
                   ->classes->...
                   ->lib->struts.jar,servlet23.jar,...
                   web.xml
                   weblogic.xml
                   index.jsp
              My errors info on the weblogic console:
              validate loginName
              admin
              8
              123456
              6
              java.lang.NoClassDefFoundError: org/apache/struts/action/ActionErrors
              at kava.web.FormUtility.getErrorFields(FormUtility.java:382)
              at kava.module.authentication.web.LoginForm.validate(LoginForm.jav
              a:118)
              at org.apache.struts.action.ActionServlet.processValidate(ActionServlet.
              java:2106)
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:156
              4)
              at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:265)
              at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
              at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              va:27)
              at kava.web.JspFilter.doFilter(JspFilter.java:82)
              at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              va:27)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
              rvletContext.java:2501)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
              pl.java:2204)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              client connection:1 closed.server connection id:0
              LocalTransXAWrapper:end
              LocalTransXAWrapper:rollback
              rollback transaction(server connection id:0)
              Cleaning up the connection
              clean up server connection:0
              What's wrong I made ? Any suggestions are very welcome !
              

    Christian,
              When you put the struts.jar in the classpath, everything works correctly? And then
              when you remove the struts.jar from the classpath and put it in the web-inf/lib it
              fails? According to the stack trace, the server appears to be able to find some of the
              struts files. Can you explain what the "kava" classes are doing? Are they part of the
              struts package?
              Thanks,
              Simon Nunn
              Developer Relations Engineer
              BEA Support
              Christian Lee wrote:
              > I success to config a web app with struts framework via welogic61 admin console,but
              > I only saw the first page but I cannot sumit to next page. (Of course,it's right
              > if I set struts.jar's classpath and web app jar in my system classpath.But it's
              > a bad solution.)
              >
              > Here is my startWebLogic.cmd:
              > ---------------------------
              > ..
              > @rem set CLASSPATH=%CLASSPATH%;%PLATFORM%\src\lib\struts.jar
              > ..
              > set STARTMODE=false
              > ..
              > ----------------------------
              >
              > My Folder Structure:
              > ----------------------------
              > WEB-INF
              > ->classes->...
              > ->lib->struts.jar,servlet23.jar,...
              > web.xml
              > weblogic.xml
              > index.jsp
              > ...
              > --------------------------------------------
              >
              > My errors info on the weblogic console:
              > ----------------------------------------------
              > validate loginName
              > admin
              > 8
              > 123456
              > 6
              > java.lang.NoClassDefFoundError: org/apache/struts/action/ActionErrors
              > at kava.web.FormUtility.getErrorFields(FormUtility.java:382)
              > at kava.module.authentication.web.LoginForm.validate(LoginForm.jav
              > a:118)
              > at org.apache.struts.action.ActionServlet.processValidate(ActionServlet.
              > java:2106)
              > at org.apache.struts.action.ActionServlet.process(ActionServlet.java:156
              > 4)
              > at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
              >
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              > pl.java:265)
              > at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
              > at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              > va:27)
              > at kava.web.JspFilter.doFilter(JspFilter.java:82)
              > at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              > va:27)
              > at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
              > rvletContext.java:2501)
              > at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
              > pl.java:2204)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > client connection:1 closed.server connection id:0
              > LocalTransXAWrapper:end
              > LocalTransXAWrapper:rollback
              > rollback transaction(server connection id:0)
              > Cleaning up the connection
              > clean up server connection:0
              >
              > -----------------------------------------------------
              > What's wrong I made ? Any suggestions are very welcome !
              

Maybe you are looking for