Can i create  client program for a servlet(without browser)

Hai All,
    I have to call a servlet in my normal java program.Please send me code.
Thanks
Madhu

Hi,
Try getting a URL connection to the servelt and send the request as
import java.net.URL;                     // New addition
import com.oreilly.servlet.HttpMessage;  // A support class, shown later
  private String getServlet() {
    try {
      // Construct a URL referring to the servlet
      URL url = new URL(getCodeBase(), "/servlet/myServlet");
      // Create a com.oreilly.servlet.HttpMessage to communicate with that URL
      HttpMessage msg = new HttpMessage(url);
      // Send a GET message to the servlet, with no query string
      // Get the response as an InputStream
      InputStream in = msg.sendGetMessage();
      // Wrap the InputStream with a DataInputStream
      DataInputStream result =
        new DataInputStream(new BufferedInputStream(in));
      // Read the first line of the response, which should be
      // a string representation of the current time
      String response = result.readLine();
      // Close the InputStream
      in.close();
      // Return the retrieved time
      return response;
    catch (Exception e) {
      // If there was a problem, print to System.out
      // (typically the Java console) and return null
      e.printStackTrace();
      return null;
Regards,
Uma
Message was edited by: Uma Maheswari

Similar Messages

  • Can we create serach help for a selection screen field

    Can we create serach help for a selection screen field with out creating searchhelp object.
    I mean is it possible to create serchelp in the program itself with some specific values i want to give.
    E.g say we can define any internal table and fill it with values and using that into selection screen fields
    Regards
    Mave

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR paymeth.
      PERFORM PAYMENT_HELP.
    FORM PAYMENT_HELP.
      DATA: begin of DESCR_TAB occurs 0,
            DESCR LIKE BKPF-BKTXT,
            END OF DESCR_TAB.
      DATA: gd_repid like sy-repid.
      gd_repid = sy-repid.
      DESCR_TAB-DESCR = 'aaaaa'.
      append DESCR_TAB.
      DESCR_TAB-DESCR = 'bbbbb'.
      append DESCR_TAB.
      DESCR_TAB-DESCR = 'ccccc'.
      append DESCR_TAB.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield    = 'DESCR'
                DYNPPROG    = gd_repid
                DYNPNR      = '1000'
                DYNPROFIELD = 'paymeth'
                VALUE_ORG   = 'S'
                DISPLAY     = ' '
           TABLES
                value_tab   = DESCR_TAB.
    endform.
    Svetlin

  • Can I create a link for captions in Adobe Captivae

    can I create a link for captions in Adobe
    Captivae

    Hi HAMADART and welcome to our community
    I'm a bit fuzzy on what you are looking for.
    If you are asking if you can create a hyperlink from a text
    caption that will open a URL or something, the answer is that you
    can, but not like you think. You would insert a caption and place
    it, then insert a click box object and program it to point to the
    URL. Then place the click box object over where you want your user
    to click.
    If you are asking if you can create a link that forces the
    Closed Captioning to display, first off I'd wonder why a link when
    clicking the CC button is so easy. But if you are asking if there
    is a way to cause Closed Captioning to display without user
    intervention, you need to take a look at fellow Adobe Community
    Expert Paul Dewhurst's site and use one of his widgets.
    Click
    here to visit Paul's site.
    Cheers... Rick

  • TS3649 my mac (2012) did not come with idvd.where can i get this program for download?

    My iMac os lion 10.7.2 (2012) did not come with idvd program. Where can I get this program for download?

    Hi
    If there is no iDVD on Your Mac (and it's not on newer Macs as Apple discarded it) then You need a program that can do this.
    Your Mac can burn CDs and DVDs - BUT DVD as Data-DVDs not as Video-DVDs - they need a program to be encoded and STRUCTURED as such.
    • iDVD is part of the boxed version of iLife'11 and can only be bought outside Apple as on Amazon and e-bay
    • DVD Studio pro - Part of FinalCut Studio Pro bundle - this to has expired and can only be bought second handed. (High price and tough learning Curve - but best ever done.)
    • Roxio Toast™ - Not as elegant as iDVD - but has many other positive additions (I like it as 10-Pro incl BD-component) (now version 11)
    • Burn - a free alternative I know of on internet. Very simple - Just for doing a plain Video-DVD
    Burn http://www.digital-digest.com/software/Burn.html
    • Free DVD Creator.app - free from Apple Store
    • FinalCut Pro-X which also can burn to DVD but without any nice themes.
    AppleMan1958
    You can also buy Compressor from Apple for $50 US. It will also create DVD and BluRay but without the nice themes.
    Yours Bengt W

  • I have multiple devices (imacs, lap tops and ipads) all connected to a NAS server.  Can I create a user for myself and one for my wife, and each have our own apple ID, and Itunes accounts, but all share the same media on NAS drives?

    I have multiple devices (iMacs, Lap tops, Ipads) all connected to a Nas Drive.  Can I create a user for myself and one for my wife and we each have our own apple ID's, Itunes etc, but share the same data on the hard drives?  So when she logs in, and sync's her ipads, they will sync with her stuff and when I do the same under my user account, on the same device, my ipads will sync with my stuff?

    You can share the same Apple ID for purchasng form the iTunes and app stores without any problems, but you should all used separate iCloud accounts with separate Apple IDs.  (You are not required to use the same ID for iCloud and other services as you do for the iTunes store.)  This will prevent you from ending up with merged data.  You should also use separate Apple IDs for iMessage and FaceTime or you will end up getting each other's text messages and FaceTime calls.
    This article may be of interest: http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/, as well as this video: http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l.

  • How can I create a URL for a PWA for MS Project Server 2010 project file that includes the view?

    Hi, this question has been answered for 2013. The answer here suggests that it can be done in  2010.
    See:
    http://social.technet.microsoft.com/Forums/projectserver/en-US/3affdc4f-36bf-4381-8b75-27c73465efd4/action?threadDisplayName=how-can-i-create-a-url-for-a-pwa-for-ms-project-server-2013-project-file-that-includes-the-view
    Who knows how?
    Regards
    Sander

    Hi Sander,
    As far as I tested it, it is not possible either with PS2010. The URL only contains the PDP name and the projUID.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • How can i create a Trash for external USB Drives ?

    Hello,
    how can i create a Trash for external USB Drives or my TimeCapsule ?
    Thanks.

    You do not need to create trash cans for individual drives.  The trash can on the desktop holds deleted files from all mounted drives.
    TimeCapsule manages its own space.  If it fills up it will delete older backps to make space for newer ones.

  • How can I create a form for users wherein the text field will expand to accommodate additional text?

    How can I create a form for users wherein the text field will expand to accommodate additional text?

    You need to use LiveCycle (PC Only) to create a dynamic form like that.
    The best you can do with Acrobat to view all of the text in a field is to set the field to multiline, and set the size to "Auto" (If you don't set the size to 'Auto', you can enter as much text as you wish, but the user will need to use the scrollbar to view all of the text.)

  • Is it possible to create a program for embedded system

    Is it possible to create a program for embedded system?

    Yes. Many solutions.
    1 = http://jcx.systronix.com/
    2 = http://www.harbaum.org/till/nanovm/index.shtml (see links to Asuro)
    And many more but I'm too lazy too look them for you ...
    Dan

  • Can we create two POs for the same 3rd party Sales Order?

    Hi MM experts,
    Issue: Can we create two POs for the same 3rd party Sales Order
    In Third party purchase process, first sales order created with a spl. item category  and it creates the PR automatically with the Sales order material and Qty and this PR converted PO.
    They got a pur.req. for sale order on same item for same delevery date. They did not get any warning msg. saying that a PO was prviously placed against this sale order.
    How it is possible that we were able to place another PO? concern is that second PO was palced against SO which was already used & completed. they were able to place 2 POs for the same customer same delevery date. How it is possible?
    If anyone face the same issue, please let me know if you have any answer to this questions.
    Thanks in advance.
    Suresh.

    Suresh,
    It is hard for me to give you a definitive answer since you have created a customized solution.
    How it is possible that we were able to place another PO? concern is that second PO was palced against SO which was already used & completed. they were able to place 2 POs for the same customer same delevery date. How it is possible?
    Normally, the system will not do this.  A third party PR or PO will be 'account assigned' to the Sales order.  SAP standard 3rd party will not create additional purchase reqs unless there has been manual intervention.  Try searching for changes in the Sales order and changes in the original purchase order.  They may give you a clue.
    I believe the normal Item category for third party SO is TAS (I am working from memory here, I am not in front of a system).  I don't know what ZTAG does.  I confess I am not an SD expert.  You might also want to post your question in an SD forum.
    You mention two custom applications, ZMMPLAN and ZSTPMP.  These somehow have functionality that is used to help you convert your PRs to POs.  If I were in your position, I believe I would also look at these applications for clues to how they might be contributing to your problem.  And please don't send me details about these apps.  I will not comment on custom code in this forum.
    Sorry I can't be of more help.
    Rgds,
    DB49

  • Can v create graphical display for the report

    Hi to everyone
    my q is this can v create trend lines for a report ........
    if the ans is yes then pl mention the way of doing it .......

    when you run a bex report on the left top you have a button "graph". If you click this, you get a basic chart representing your output table. when you right-click on the chart you get the option menu as you get in xls, meaning you can change the type of chart (line, bar, pie,...) the series, the titles and so on (like regular xls)
    so the answer to your question is yes. If you want even more features you can use workbooks.
    M.

  • Can i Create Output Variable for DB Polling in BPEL 11g?

    Hi Team,
              I want to create the Output Variable for DB Polling,But when i double click on Reply Activity-->Create New Variable it is giving error message like "Can't Create output variable.The Selected operation doesn't have an Output Message".
    My Question is Can we create Output Variable for DB Polling, if Yes tell me the procedure to create the Output variable ?
    Regards,
    Kiran

    Hi Kiran,
    In these scenario generally runtime faults occurs so you can use the CatchAll activity and rethrow activity to complete the instance in error state. Also before the completion of the process if exception occurs you can rollback all the transaction.
    or
    you can use the Fault handling framework:
    Using Fault Handling in a BPEL Process - 11g Release 1 (11.1.1.7)
    Regards,
    Anshul

  • Can I create folders (albums) for my photos and move them?

    Can I create folders (albums), for my photos and then relocate said photos to specific folders?

    These links may be helpful.
    How To Create Photo Albums http://tinyurl.com/cxm4eoq
    How to Add New Albums in the Photos App on the iPad & Add Photos to the Album
    http://tinyurl.com/7qep7fs
     Cheers, Tom

  • Can we create an index for a list of itmes in a single object?

    Can we create an index for multiple values in a single object. We have an object Order that contains list of items. I like to get all orders for a specific item. I want to create an index to speed up the query. Is it possible? What are the other alternatives?
    My Order object is as follows:
    Orders
    Item List
    Shipping Address
    Example:
    Order 1
    i1, i2, i3, i4
    123 some way, city, 12345
    Order 2
    i2, i3
    333 some other way, city2, 33333
    order 3
    i2, i4, i7
    My search would be, give me all orders that has item i2. It should return Order 1, Order 2 and Order 3.
    Thanks

    Hi,
    I think that this will work ...
    ValueExtractor extractor= new ReflectionExtractor("getItemList");
    cache.addIndex(extractor, true, null);
    Set setKeys = cache.keySet(new EqualsFilter(extractor, i2));
    In this case, the Collection value extracted by the ValueExtractor is treated as a Collection of contained attributes when the index is created.

  • Can I create a network for printing & music alone ?

    I don't have DSL or any type of broadband - still using dial up.
    If I buy an Airport Express can I configure it to wirelessly print and stream music or do I need a wireless network in the background to make this work ?

    Can I create a network for printing & music alone ?
    Yes
    If you also want internet access at the same time you will need to tweak things a bit.

Maybe you are looking for

  • Telling ID CS5 to seek a linked file in the current folder

    For at least 5 years (and all the versions of ID), I've been unable to set up a link on text or a graphic that, when clicked, will open another PDF, because I want Acrobat Reader to look for the new PDF file in the same folder/directory as the curren

  • Can we call a bean in Weblogic 6.0 from Weblogic 5.1

    Is it possible to call a (stateless session) bean deployed in weblogic 6.0 from a bean in weblogic 5.1? I have two versions of weblogic running on two different hosts and I have to call a bean that is running in 6.0 from 5.1. Are there any limitation

  • Aren't iPods suffering from overprotection?

    I see new skins, cases, protecting films and other accessories to wrap and protect iPods being advertised almost daily. On the other side, there are thousands of posts of users in many different discussion forums who are extremely afraid of getting t

  • Here's an odd problem

    I have just upgraded to CS4 so I'm not sure if this is related to that but it is driving me crazy. I have an invisible space image "spacer.gif" originally 1px x 1px sized to 800px x 50px. I have often used this method to hold open a space in a layout

  • How to access web server with SSH client

    I need to access my web server via SSH. I do not have clue how to go about. I have transmit for ftp but looks like I cannot use SSH with Tranmit. I guess I need to know: - What ssh client to I need to get? - If not detailed instruction provided How d