Results 1 to 6 of 6

Thread: need a help!!

  1. #1
    ras_pari is offline Member
    Join Date
    Oct 2009
    Posts
    40
    Rep Power
    0

    Unhappy need a help!!

    hi..
    I want to know what is the code for servlet producing a image???I need it urgently...but I not able 2 get it???plz help me!!!!!!!!

  2. #2
    renamed is offline Member
    Join Date
    Dec 2009
    Location
    Rio de Janeiro
    Posts
    38
    Rep Power
    0

    Default

    People won't post the solution to your problem (at least not for free) hehehe

    Try to show that you're interested and paste here something that you've done and the questions that you have! =)
    Please don't laugh at my English... I'm trying my best! :)

  3. #3
    raqman is offline Member
    Join Date
    Sep 2009
    Posts
    37
    Rep Power
    0

    Default

    Hi.
    In my opinion, you can refer to the url below:
    Create dynamic images in Java servlets - JavaWorld
    Regards,
    raqman.
    RAQ Report: free Java reporting tool.

  4. #4
    billq is offline Member
    Join Date
    Dec 2009
    Posts
    25
    Rep Power
    0

    Default class vs object

    Thankyou for the replies. I am reading dave eck's book online. Sec 3.8 starts to talk about applets. And the sentence

    An applet is a Java program that runs on a Web page. An applet is not a stand-alone application, and it does not have a main() routine. In fact, an applet is an object rather than a class.

    confused me. I come from c++. And object is just an instance of a class. To me, the above sentence means that the applet is created from a class and not something else.

    thanks
    bill

  5. #5
    ras_pari is offline Member
    Join Date
    Oct 2009
    Posts
    40
    Rep Power
    0

    Default

    hi...
    Java Code:
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import linegraph.xyLine.;
    public class GetParameter extends HttpServlet {
      public void doPost(HttpServletRequest request,HttpServletResponse response)
        throws IOException, ServletException{
      
        
        String line = request.getParameter("t1");
        String line1 = request.getParameter("t2");
        String line2 = request.getParameter("t3");
        String line3 = request.getParameter("t4");
    
    
       
    int coordinates=Integer.parseInt(line); 
    int coordinates1=Integer.parseInt(line1); 
    int coordinates2=Integer.parseInt(line2); 
    int coordinates3=Integer.parseInt(line3); 
    // set the response type
    response.setContentType("image/gif");
    // send the image straight to the client
    ServletOutputStream out = response.getOutputStream();
    
    
    xyLine rashi=new xyLine();
    rashi.addd(20,40,20,20);
    
        
      }
    }
    This is my code(servlet program) where I have receive a 4 values from html page.then I have 2 dispaly a graph according to that value .program for displaying a graph is the above code....but that not working.plz correct me.xyline is another java program for creation of graph.

  6. #6
    gcampton Guest

    Default

    try not to hijack threads billyq, getting your head around java concepts is a little different to c++, it's annoying I am constantly confusing myself in C++ because I assume, things in c are pretty much the same as java. for instance: 2-dimension arrays are not 2-dimensional arrays in C++ they are just "regular arrays with syntactical sugar" as most C++ gurus believe.
    ( "pppffffttt" is the response that pops into my mind..)

    truth is I don't think it matters too much how you look at things, so long as you understand the logic your programs need to follow, the syntax of the language, and keeping it simple. Semantics can be ignored.

    look at it this way, applets were originally designed to be embeded in webpages, but then the "applet viewer" came about so now applets can actually be run much like programs (why you would want this is redundant). Apps are apps, applets are just apps.
    However applets don't contain a main they are instantiated much like an object.

    When you create an object of a class that is of type applet it makes an "object of that class" so you are correct. just ignore semantics so long as you kinda grasp how to make an applet happen, and when the best time to use them is... nothing else matters.


    also in java, we have 'primitive objects' 'Integer', 'Double' etc (these are classes that you can make objects of), and arrays and strings are also objects. everything is object.... aparently
    Last edited by gcampton; 01-04-2010 at 08:14 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •