Save Article. Like Article. Last Updated : 19 Jan, To open any URL we use different predefine files of java to operate with our Desktop. Desktop : We use java. Desktop class because java. Desktop allow us to interact with different capability of our Desktop. URI : java. Algorithm: Firstly, we create an Object of our-defined class that we import by java. During the creation of an object, we use getDesktop method that returns the Desktop instance of the current desktop context.
I just want to open a webpage in browser. In that webpage i have some form hidden text fields and i want to post the data into that hidden fields through post method. In other words whenever the webpage is opened i want those hidden fields to be filled with post data. Clare McLennan wrote: That all sounds very complicated for something that is quite straightforward.
BUT there IS concern about users seeing user ids and passwords in the address bar of the website. Ulf Dittmer wrote: you should also use an encrypted connection i. Credentials should not be sent through an unencrypted connection. Forum: Java in General. Optional 'thank-you' note:. Please could anyone guide me to do this. I dont have a clue in this. Your help is much appreciated.
Thanks in advance. Roger Sterling. I like Try exec. If you actually want to manipulate the GUI on-screen, thats a whole different ball game that requires advanced knowledge. In essence, you need to get the GDI instance , search for the pattern of pixels you want to use as a reference, then position the cursor over those pixels, and post WMI messages into the WMI queue for the characters you want to appear. Ulf Dittmer. Do you actually have to open a browser?
If you just want to post the form, using a library like HtmlUnit would seem a much better approach. Campbell Ritchie. Winston Gutkowski. But do you? What you're describing is how you want to solve the problem , when you haven't actually told us WHAT the problem is.
And at first glance, Ulf's suggestion would seem like a very sensible and much simpler alternative. You may have failed to encode the query string.
And you need to pass the parameters, not the command line. To me, it doesn't sound like you need to open a browser to do that; am I missing something? What do you think of the approach I suggested in my previous post? Just curious, but how could I have improved this answer? I was not going for something very nice looking, i am just trying to put together something that functions — GA Tech Mike.
I will probably give your code a try later on, but i did not try to run it Well, I also gave you saua's way before saua posted it. That's what the last sentence is referring to did I make it unclear? Show 2 more comments. That would be a one-liner: getAppletContext. Rich Apodaca Rich Apodaca They provide sample code to set up an online html viewer: import javax. Geo Geo If you do it with Runtime you would need to know wich browser the user runs.
Hardly the best option — Nuno Furtado. So you check for the presence of 3 browsers. I never said this was the best option. Please try below code : import java.
Desktop; import java. URI; import java. LuFFy 7, 10 10 gold badges 37 37 silver badges 58 58 bronze badges. ElementCodez ElementCodez 29 6 6 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog.
0コメント