Hi, I´m fairly new to Java and need help with a problem I´m unable to solve and so far all searches have turned up empty.
There is a webpage that contains a form. I have a java desktop application that stores a database with data I want to use to fill the form. The user scenario is as follows:
In the application:
1) The user opens the application and finds the desired row in database table.
2) The user clicks "open on website" button.
In the browser:
3) The webpage opens in a browser with the form already prefilled.
4) The user fills in captcha and clicks "submit" button on the webpage.
5) The result displays (just for the user to see, there is no parsing performed)
The problem is between steps 2 and 3. Is it even possible to open the website in a browser with the form already prefilled?
I have already tried htmlUnit, but failed, though that could be due to my inexperience. I cannot modify the webpage in question (it is run by state). Unfortunately, just submitting the form programatically and parsing the returned html page is not an option - the user always has to click "submit" button himself (in this case, actually, herself).
Hi Joe, before coming to your presentation, on button click call a servlet which will have table values in response and fill those values in corresponding fields.
1. dont come directly to html page
2. give a link like https://infodokument.justice.cz/erozhodnuti-web/showForm 3. make a servlet showForm and set Attribute in request
4. dispatch that request to html page
5. fill all values in html.
I hope this will help you.
Joined: Aug 27, 2012
Thanks for your reply. There is a problem though - likely caused by my inexperience - perhaps I do not understand what you meant by step 2, but I think you want me to modify the webpage in question (https://infodokument.justice.cz/erozhodnuti-web/). Unfortunately, I cannot do that, since I do not have the administrator rights for that webpage
See RoboForm (a password manager) as an example that proves you can do this with any page, as long as you have a browser plug-in installed. You could probably do the browser part using greasemonkey scripts (or similar) as long as you can get those scripts to communicate with your application.