I am installing searching derive from a website using java which is effective for page one.

URL url = new URL(
BufferedReader in = new BufferedReader(new InputStreamReader(

String line;
while ((line = in.readLine()) != null) {

But exactly how could I recieve the 2nd page from the result? The hyperlink towards the second page utilizes a javascript call javascript:__doPostBack('ctl00$ContentBody$pgrBottom$lbGoToPage_2',''), which refers to this as function:

<script type="text/javascript">
var theForm = document.forms['aspnetForm'];
if (!theForm) {
  theForm = document.aspnetForm;
function __doPostBack(eventTarget, eventArgument) {
  if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
      theForm.__EVENTTARGET.value = eventTarget;
      theForm.__EVENTARGUMENT.value = eventArgument;

I believe, i have to call the function from the java programm to obtain the second page, but exactly how?

From what I will tell you need to execute __doPostBack(...) as though it were on the web site performing inside a browser. I can not observe how you could do this that programmatically using Java. Personally I'd try to by hand produce the publish request the Javascript is invoking (maybe using something similar to this). I understand it is not ideal if the page changes the application wont work any longer nevertheless its the only real reasonable solution I'm able to think about.

Can One request just what you are attempting to attain? Would something similar to Selenium help?

Use Direct Web Remoting (DWR). This engine supports calling java techniques from JavaScript and the other way around. Find more information at http://directwebremoting.org/dwr/index.html

take a look at javax.script.ScriptEngine and javax.script.ScriptEngineManager along with other stuff within the package:

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");