Paul Hankerg

Greenhorn
+ Follow
since Jul 11, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paul Hankerg

Hi, I have a jsp page, and there is a button on it, when I click this button, I want to go to another url, let's say http://www.google.com. Is it possible to do it. Can one give me a clue how to implement this using Java?

I tried something like

URL link = new URL(intraURL);
HttpURLConnection httpConnect = (HttpURLConnection)link.openConnection();
httpConnect.setRequestMethod("GET");
httpConnect.setDoOutput(true);
System.out.println(httpConnect.getURL());
httpConnect.connect();

It doesn't work, I guess the above codes just makes a connection, but not physically go to the page.

any help will be apprecitaed.

thanks.
17 years ago
JSP
Hi Ernest;

Actually I did exactly
Runtime.getRuntime().exec("cmd /c C:\\backup\\mydoc.pdf");

Not working.
17 years ago
Thanks, Ernest, if you don't mind, could you provide some simeple codes to show how to do it? Suppose my PDF file now is in server's C:\backup\mydoc.pdf. I have no problem to access it.
17 years ago
Thank, Ernest, if you don't mind, could you write some simple codes to show how to open the file. Let's say this PDF file is now in myServer's C:\backup\mydoc.PDF. How can we open it?

I tried Henry's
Runtime.getRuntime().exec("cmd /c C:\backup\mydoc.pdf");

not working.

thanks.
17 years ago
Thanks Henry;

Yes in run, it does exactly what I want. But in Java class, it doesn't open the PDF file. In my tomcat's log file, I find it print out the content of the file in my log flie.
17 years ago
Hi Ernest;

I am using a set of system based on Java/JSP, which is called WDK from documentum. But my question is a pure java question. I don't want to go any further to make thing more complicated.

To answer your question, I think the java program that I am talking about is JSP. Let's say, when you click a button on a jsp page, and you want to do soemthing (in my case, create a pdf file and open it), you need write some java codes to do this, right? You could put these java codes in the web page or you could put these java codes in a java class. But somehow you need write some java codes to make it happy, right, and that's what "java action program" means.

As you could say, I created this PDF file, so I could save it anywhere I want. I guess my bad explanation complicate this things, and I truly believe this should be a very easy thing.

thanks again.
17 years ago
How about the PDF file is stored in the server? I could save the file in server.
17 years ago
It seems I don't explain "open" well. When I say "open a PDF file", it's just like we click this PDF file, and I don't care it's Adobe reader or Adobe acrobt did the job. The only difference is I want the program do the click job for me automatically.
17 years ago
Ok, here is my situation.

I hava a web page, and I hava a button on it. When a user clicks this button, an action java program will create a PDF file, and put it on the local machine(So Java program knows exactly where is), then I want to open this PDF file. So one click, two things: create a PDF file and open it. I hava already created the PDF file, but I don't how to open it. I don't care what I need to use, browser or applet, all I want is to open this PDF file. I believe that deliever the job to the browser is a good idea, but the question is how to invoke it in the Java program. If you still don't understand my question, please let me know. Thanks.
17 years ago
Thanks Jim. It seems things are getting more complicated, now I need worry about how to start a browser. All I need is to open a file in Java program no matter using browser or not.
17 years ago
Thanks. How can we call browser in Java? Actually I think it's a good idea to use broswer to open the file. But the question is how can we call brower to open the file in Java program?
17 years ago
thanks for the response.

Here is really I want to know. On a web page, I have a button, when a user clicks this button, it will open a PDF file, and Java program know where this PDF file is. I don't want to use Java script. The open action should happen in Java program. Thanks.
17 years ago
Hi, let's say I have a PDF file in the local machine, how can open it through Java program? When I say "open", I mean open the file and show the content to the user.

thanks,
17 years ago