Need Help!  Applet Servlet Portlet Communication

Hi
My applet need to send a keyWord to let a portlet to do some operations. I know an applet can communicate with a servlet by URLConnection.But how can portlet? Can I consider a portlet as a servlet and let the applet communicate with the portlet like servlet by URLConnection? could you tell me whether this is possible?
Thanks for your help.

Hi
You have a white-space in the codebase, remove it.
If that doesn't help, make a static html page, test the Applet with it.
/Tobias - hopes this helps

Similar Messages

  • Need Help Running Servlets

    I have JRun installed along with IIS 5.0 and I'm learning Servlets through the book "Java Servlets" by Karl Moss. I have written my first servlet but he doesn't do a good job telling you how to get started. I need to know how to get my server ready to run the servlets and in what format to save the servlets. I have Homesite 5 and when I create a new servlet, it wants to save the file as a .java. I need some newbie help. Thanks, Jeremy

    you should make sure of the follwoing when trying to run your servlet on the browser:
    1. make sure that your classpath set properly,
    2. make sure that the class path include the api related to servlets, such as servlet.jar, and other jar files.
    3. complie your servlet, and package it properly, so that the container can locate it.
    if you done the above, then things will work
    I really advice you to check moreservlet.com, because it contains information on how to set up the environment when using either tomcat, jrun, or iplanet
    regards

  • Need help with servlets!!!

    Hi, I'm a beginner in Oracle and Servlets. So far I was able to make a servlet which could run a query to an existing table of an oracle database and return this data in an HTML form generated by that same servlet.
    I need some help on making a servlet that can accept user input and make an insert into that same existing table.
    null

    I suggest you break up the problem into manageable sub projects and solve each one in isolation. First, create a 'hello world' servlet. Search google for examples. Here is one problem with your code: if WelcomeServlet3 is in a package called 'myServlets, then you would use something like this: <servlet-class>myServlets.WelcomeServlet3<;/servlet-class> in the web.xml file.
    Next, is your database connection: I suggest you create a database connection in a class with a 'public static void main(String[] args) method to call it. Have the configuration data within the class. Dont get it from an xml file. This way, you can run it stand-alone by right clicking on the class and choosing 'run as application' and therefore ensure it works.
    Next go to the tomcat home page and read up on how to configure a database in tomcat by putting the configuration data in an xml file. Make sure you're reading the about the version of tomcat you're using. For all versions of tomcat, its something like this: If your web application is called 'myWebProject', then there should be an configuration xml file called 'myWebProject.xml' that goes under one of the tomcat sub folders. You use JNI to get the configuration data out of that xml file to configure the database. There is no database configuration data in the web.xml file.

  • HELP Applet -- Servlet File Renaming

    I have written an applet that includes a JFileChooser. This JFileChooser uses an ObjectOutputStream and ObjectInputStream to send a vector of Files to a Servlet. Everything works up to the point where the Servlet pulls the files from the vector so they may be copied to the server. I get a FileNotFound exception because the vector contains the Files with the client's paths (which the server doesn't recognize!). If I run the app on localhost, everything works fine.
    Thanks in advance,
    Chris

    Greetings,
    I have written an applet that includes a JFileChooser.
    This JFileChooser uses an ObjectOutputStream and
    ObjectInputStream to send a vector of Files to aFirstly, java.io.File is simply an object representation of a potential entity on the local filesystem. Simply creating/having a 'File' instance neither guarantees the referenced entity exists nor does it, by itself, give access to the referenced entity's contents...
    Servlet. Everything works up to the point where the
    Servlet pulls the files from the vector so they may beWhich, in this case, is simply instances of java.io.File...
    copied to the server. I get a FileNotFound exception
    because the vector contains the Files with the
    client's paths (which the server doesn't recognize!).This is correct! Again, Files are references to the local filesystem. To actually "copy" the file to the server it is necessary to send the file's contents as well as its name. Try using DataOuputStream and DataInputStream for this. ;)
    If I run the app on localhost, everything works fine.Refer back to the above. :)
    Thanks in advance,I hope this helps.
    ChrisRegards,
    Tony "Vee Schade" Cook

  • Need help on creating portlets using JSR268.

    Hi All,
    I want some details about how to create portlets with JSR 268 statndards.
    I am creating portlets with address and location viewer using google maps service.
    how to pass address parameters to the map portlet ?
    thanks
    Gopi

    If you want to pass parameters from one portlet to another, you should use parameters. I am currently working on a blog post that shows these features. I'm hoping to have it finished by the end of the day...
    Meanwhile i can tell you that you need to create parameters in the portlet.xml as shown in this image: https://picasaweb.google.com/yannick.ongena/IPC#5636361095514333538
    Then you need to tell assign that parameter to the portlet as shown here: https://picasaweb.google.com/yannick.ongena/IPC#5636361093578581890
    A thirth thing to do is set the value of the parameter. In your locations portlet you should write following code to set the parameter:
    PortletRequest req = (PortletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
    req.setParameter("nameOfParameter",value); In your maps portlet you can read the value of the parameter with following code:
    PortletRequest req = (PortletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
      String param = (String)req.getParameter("nameOfParameter");
      if(param == null)
          return "someDefaultValue";
      return param;You might need to set a partialTrigger on the maps portlet that points to the location portlets. That's it.

  • Need help - basic Java card communication ???????

    Please could someone tell me if JavaCard is conforming to OpenPlatform 2.0.1 how does it communicate to host application, through wincard.dll or thorough some other library ?
    Thanks.

    it depends wich JavaCard, I know that only JCOPs are fulli compliant to 2.0.1 and new ones partly to 2.1 ...
    Communication is depending on the reader that you are using, normally pc/sc interface will do. Otherwise you need some special libraries, like for contactless readers & cards ....

  • Need Help  to develop  Portlet in JDeveloper 10.1.2.10

    I do not know what the best best way to start develop Portlet in short period of time .I would be glad if any one can share his experience how they started to develop portlet in JDeveloper.

    Oracle Application Server 10.1.2 does not contain a portlet container. To deploy to Oracle Application Server 10.1.2
    1.     Install Oracle database 10g (10.1.0.4.2 or later)
    2.     Install Oracle Application Server (10.1.2.0.2) Infrastructure.
    3.     Install Oracle Application Server (10.1.2.0.2) J2EE and Web Cache
    4.     Install Oracle Application Server (10.1.2.0.2) Portal and Wireless.
    5.     Upgrade Portal to 10.1.4
    6.     Configure Java WSRP Container in Middle Tier.
    7.     Start the OracleAS Portal Builder
    8.     Deploy a WSRP Portlet Application in Oracle Application Server.
    9.     Register the WSRP Provider in OracleAS Portal.
    10.     Add a Portal Page.
    11.     Add the WSRP Portlets to Portal page.

  • Need help nokia e 90 communicator

    please help me all the keys are nor working on internal key board and lights also dont work i tried resetting the phone but still same and when i press z key instead of z y comes and vice versa please help me with this issue

    Hi kittubaba,
    Welcome to the Nokia forum!
    If the keys of your phone are not working and the back light is playing up, update the software with Nokia Suite to see if this makes a difference.
    If this same issue comes back, please visit a local care centre where they can check your phone and fix this for you. You can find your nearest care centre by visiting your local Nokia web page and clicking on the Support tab. 
    Regards,
    Iris9290
    If my post has helped you in any way, please accept it as a solution or click on the white star, so that other users will be able to benefit from it too.

  • Beginner needing help with servlet setup

    im trying to setup a simple servlet but it seems that my html page will not invoke the java servlet. perhaps it is due to the location of the servlet class, is there a special directory to store the servlet in? or will storing it in the same dir as the html page suffice? Im using j2ee application server here is the html code im using:
    <FORM ACTION="UploadTest" ENCTYPE="multipart/form-data" METHOD=POST>
    What is your Name? <INPUT TYPE=TEXT NAME=submitter> <BR>
    Which file would you like to upload? <INPUT TYPE=FILE NAME=file> <BR>
    <INPUT TYPE=SUBMIT>
    </FORM>
    the directory im working in is:
    C:\Sun\AppServer\domains\domain1\docroot\upload
    which contains the html and the .java servlet
    the servlet is named UploadTest.java
    any advice would be appreciated

    ur class file should be in
    WEB-INF\classes folder
    then u should map this class with the urlpattern in the web.xml file
    u can invoke the servlet only with url pattern ur giving in the web.xml
    i think u get me
    regards
    shanu

  • Hello, I have a problem on my iPhone every second turn on and off I mean it shows the apple and off and again shows the apple icon and off and tried to Restore and it hangs on my iPhone and then waits Error 3004 Please I need help please!

    Hello, I have a problem on my iPhone every second turn on and off I mean it shows the apple and off and again shows the apple icon and off and tried to Restore and it hangs on my iPhone and then waits Error 3004 Please I need help please!

    Resolve communication issues
    Related errors: 17, 1004, 1013, 1638, 3014, 3194, 3000, 3002, 3004, 3013, 3014, 3015, 3194, or 3200.
    These alerts refer to gs.apple.com, say "There was a problem downloading the software," or say the "device isn't eligible for the requested build."
    I would guess your iphone has been hacked ( jailbroken ) ring any bells ?

  • Need help with applet servlet communication .. not able to get OutputStream

    i am facing problem with applet and servlet communication. i need to send few image files from my applet to the servlet to save those images in DB.
    i need help with sending image data to my servlet.
    below is my sample program which i am trying.
    java source code which i am using in my applet ..
    public class Test {
        public static void main(String argv[]) {
            try {
                    URL serverURL = new URL("http://localhost:8084/uploadApp/TestServlet");
                    URLConnection connection = serverURL.openConnection();
                    Intermediate value=new Intermediate();
                    value.setUserId("user123");
                    connection.setDoInput(true);
                    connection.setDoOutput(true);
                    connection.setUseCaches(false);
                    connection.setDefaultUseCaches(false);
                    // Specify the content type that we will send binary data
                    connection.setRequestProperty ("Content-Type", "application/octet-stream");
                    ObjectOutputStream outputStream = new ObjectOutputStream(connection.getOutputStream());
                    outputStream.writeObject(value);
                    outputStream.flush();
                    outputStream.close();
                } catch (MalformedURLException ex) {
                    System.out.println(ex.getMessage());
                }  catch (IOException ex) {
                        System.out.println(ex.getMessage());
    }servlet code here ..
    public class TestServlet extends HttpServlet {
         * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
             System.out.println(" in servlet -----------");
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            ObjectInputStream inputFromApplet = null;
            Intermediate aStudent = null;
            BufferedReader inTest = null;
            try {         
                // get an input stream from the applet
                inputFromApplet = new ObjectInputStream(request.getInputStream());
                // read the serialized object data from applet
                data = (Intermediate) inputFromApplet.readObject();
                System.out.println("userid in servlet -----------"+ data.getUserId());
                inputFromApplet.close();
            } catch (Exception e) {
                e.printStackTrace();
                System.err.println("WARNING! filename.path JNDI not found");
            } finally {
                out.close();
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            System.out.println(" in foGet -----------");
            processRequest(request, response);
         * Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            System.out.println(" in doPost -----------");
            processRequest(request, response);
         * Returns a short description of the servlet.
         * @return a String containing servlet description
        @Override
        public String getServletInfo() {
            return "Short description";
        }// </editor-fold>
    }the Intermediate class ..
    import java.io.Serializable;
    public class Intermediate implements Serializable{
    String userId;
        public String getUserId() {
            return userId;
        public void setUserId(String userId) {
            this.userId = userId;
    }

    Hi,
    well i am not able to get any value from connection.getOutputStream() and i doubt my applet is not able to hit the servlet. could you review my code and tell me if it has some bug somewhere. and more over i want to know how to send multiple file data from applet to servlet . i want some sample or example if possible.
    do share if you have any experience of this sort..
    Thanks.

  • Asynchronous applet-servlet communication

    Hi all,
    I am trying to implement asynchronous applet-servlet communication and need your help. Anything would help(I tried with synchronous applet-servlet communication but doesn't solve my problem).
    Thanks,

    http://java.sun.com/docs/books/tutorial/networking/index.html
    You can open a socket connection. Bother the client and the server
    can have separate threads for reading and writing and that you gives you
    asynchronous communication. Later, if you think the server is generating
    too many threads and not scaling, you can use features of .java.nio to
    make it more scalable:
    java.nio.channels

  • Applet/servlet communication for byte transmission

    Hello all !
    I wrote an applet to transfer binary file from web servlet (running under Tomcat 5.5) to a client (it's a signed applet) but I have a problem of interpretation of byte during transmission.
    the code of the servlet is :
            response.setContentType("application/octet-stream");
            ServletOutputStream sos = response.getOutputStream();
            FileInputStream fis = new FileInputStream(new File(
                    "C:\\WINDOWS\\system32\\setup.bmp"));
            byte[] b = new byte[1024];
            int nbRead = 1;
            while (nbRead > 0) {
                nbRead = fis.read(b);
                System.out.println("octets lus = " + nbRead);
                sos.write(b, 0, nbRead-1);
            fis.close();
            sos.close();et le code de l'applet qui appelle cette servlet est :
            URL selicPortal = null;
            try {
                selicPortal = new URL(
                        "http://localhost:8080/AppletTest/servlet/FileManipulation");
            } catch (MalformedURLException e) {
                e.printStackTrace();
            URLConnection selicConnection = null;
            try {
                selicConnection = selicPortal.openConnection();
            } catch (IOException e) {
                e.printStackTrace();
            selicConnection.setDoInput(true);
            selicConnection.setDoOutput(true);
            selicConnection.setUseCaches(false);
            selicConnection.setRequestProperty("Content-Type",
                    "application/octet-stream");
            try {
                InputStream in = selicConnection.getInputStream();
                FileOutputStream fos = new FileOutputStream(new File(tempDir
                        + "\\toto.bmp"));
                byte[] b = new byte[1024];
                int nbRead = in.read(b);
                while (nbRead > 0) {
                    fos.write(b);
                in.close();
                fos.close();
             } catch (IOException ioe) {
                ioe.printStackTrace();
            }the file dowloaded is broken. it seems that bytes 01 00 or 00 01 are not correctly process.
    Some ideas to help me please ?

    hi,
    have you solved this issue.. please post me the code since i m also doing the applet/servlet communication and can use your code as reference.
    how to read the content placed in the urlConnection stream in the servlet
    Below is my code in applet
    public void upload(byte[] imageByte)
              URL uploadURL=null;
              try
                   uploadURL=new URL("<url>");
                   URLConnection urlConnection=uploadURL.openConnection();
                   urlConnection.setDoInput(true);
                   urlConnection.setDoOutput(true);
                   urlConnection.setUseCaches(false);
                   urlConnection.setRequestProperty("Content-type","application/octet-stream");
                   urlConnection.setRequestProperty("Content-length",""+imageByte.length);
                   OutputStream outStream=urlConnection.getOutputStream();
                   outStream.write(imageByte);
                   outStream.close();
              catch(MalformedURLException ex)
              catch(IOException ex)
    How can i read the byte sent on the outstream (in above code) in the servlet.
    Thanks,
    Mclaren

  • Is there a good advanced review on applet-servlet communication

    I am working on a web application and unfortunately experiencing a lot of trouble trying to use an applet as front end which interacts with a couple of servlets running on Tomcat. I need to get data from one servlet and send data to another.
    There is a lot of messages posted in this and other forums about how to do this, but none of them got a response pointing to a useful advanced reference on this subject. I have reviewed some of the references given, but couldn't find a thorough detailed advanced reference on applet-servlet communication. For this I mean an exhaustive explanation of the mechanism of communication and when and when is neccesary to use each of the multiple configuration possibilities regarding content-type, message-length, request-method, connection settings, and so on.
    Would anybody be so kind to show me the right direction? As I read the (literally) hundreds of messages posted on this topic, I see this info as widely useful. Most of the topic tracks ends on void or with painful no-way sentences, and maybe many people is avoiding Java technology on web application because of this problem (development delays can abort a project).

    This sample chapter in Java developers' guide to Servlets and Jsp focuses on Applet-Servlet communication, is a pretty good one, and is free :
    http://www.javaranch.com/bunkhouse/samps/2809ch12.pdf
    As to an exhaustive & complete guide that covers absolutely everything, I may be wrong but I doubt you'll find anything like that...unless there is a book somewhere dedicated to the subject.

  • Applet/Servlet communication - StreamCorruptedException

    Hi, I'm having a problem when I try to connect to a servlet. I am using applet/servlet communication. The problem only occurs when I have lauched a crystal report via http in a new window.
    After the report is launched if I try to hit my servlet I get the following error:
    java.io.CorruptedStreamException: invalid stream header
    Not all crystal reports I launch cause this behavior but I can see nothing in the url I use to launch the report that is out of place or different than other reports.
    APPLET-SERVLET CONNECTION
    try {
    StringBuffer path = new StringBuffer();
    path.append(ip);
    path.append("servlet/DatabaseServlet?");
    path.append("option=getRecords&query=").append(URLEncoder.encode(query,"UTF-8"));
    URL url = new URL(path.toString());
    URLConnection servletConnection = url.openConnection();
    servletConnection.setUseCaches(false);
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setRequestProperty("Content-Type", "application/x-java-serialized-object");
    ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
    rc = (RecordCollection) inputFromServlet.readObject();
    inputFromServlet.close();
    } catch (Exception e) {
    e.printStackTrace();
    SERVLET CODE
    Forwards to doPost
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    System.out.println("session id: " + request.getSession().getId());
    this.doPost(request, response);
    LAUNCHING REPORT FROM APPLET
    try {
    String launchURL = host + directory + report + "?promptOnRefresh=0"+ "&" +
    authentication + "&" + key + "&" + startPeriods + "&" + reportYears + "&" + reportTitle + "&" endPeriods "&" + locations + "&" + reportPeriod + "&" + fiscalWeek + "&" + fiscalYear + "&" +time;
    context.showDocument(new URL(launchURL), "_blank");
    } catch (Exception ex) {
    ex.printStackTrace();
    SAMPLE URL THAT CAUSES PROBLEM
    http://localhost:113/Reports/OpenToBuy_3.class?promptOnRefresh=0&user0=rpuser&password0=er34sw1&[email protected]=rpuser&[email protected]=er34sw1&user0@sub2=rpuser&[email protected]=er34sw1&promptex-key="L","L1","ALL"&promptex-start="1"&promptex-years="2004","2004"&promptex-title="Report Title"&promptex-end="1"&promptex-locs="01","03","04","05"&promptex-period="Feb 2004 [04-01]"&promptex-cw="1"&promptex-cy="2004"&promptex-time=-2-52728"
    Everything works fine until I launch this report then I can no longer get data from my servlet. I thought the URL lenght for the report might be the problem but I lauch a report with a URL longer than the problem one and there I don't get the errors after. When I try to connect to the servlet the println statement in the doGet method of my servlet doesn't get printed so it's not even making it inside that method in the servlet.
    Anyone have any idea what could be causing this? Anyone have any ideas what would be causing this? I'm really stumped.

    I've seen this problem before. Because your accessing a complete URL (ie http://<host>:<port>/xxx), you are actually creating a new session. Whenever the applet opens a connection to a servlet it is running on it's own session not the same as the JSP. This is rather obvious since the Page and Applet are separate entities.
    Try sending authentication with the url. I think the syntax is:
    username:password@http://localhost/xxx
    However I'm not sure how well this might work for Tomcat. As for Java it may try and throw a MalformedURLException I would have to test it first - it's been a long time since I used this technique!
    Wish I could be more help,
    Anthony

Maybe you are looking for

  • Can not see the administration tab in EM

    Hi, I installed Oracle 10g EE Release 2. However, when I log in to EM and I want to see the Administration tab, I have to enter again the user and password I gave them and I got this error: Database error I/O Exception: Unknown host specified I check

  • Problem during Database Creation of 8.1.7 in Linux7.2

    hello folks, i am having a problem in creating database of 8.1.7 in Linux7.2 RedHat. after successful installation,,and after even successfull listener configuration,, when database creation assistant is creating database; On 82% At "Initializing dat

  • What's a good Wifi USB adopter for Macbook OSX 10.5.8?

    The wifi on my Macbook is broken and I heard a wifi USB adopter is a good solution.  Unfortunately, the Linksky bought from Best Buy wasn't comparable and apparently none of the retail stores has one that is.  Any suggestions?

  • No Color on TV

    Hi Im having trouble getting colors on my TV when connecting it to my Macbook. Its connected through the Mini-DVI -> S-video, it shows the picture and all, but its only in grayscale, pretty annying, im not using VGA or DVI because its an old TV. The

  • SQL Server 2012 Analysis Services Deployment Wizard broken after SP1

    I have installed SQL Server 2012 SP1, now I cannot edit Data Source Connection Strings anymore in the Deployment Wizard. When clicking the button labeled "..." I get an error "Could not load file or assembly 'Microsoft.Data.ConnectionUI, Version=8.0.