
I have a simple Java class in which I invoke a call to a JSP page, by launching a browser. I have this part working, but now I want to pass variables from the simple Java class to the JSP page. How can I do that?
Here is my code:
public static void openURL(String url) {
String osName = System.getProperty("os.name");
if (osName.startsWith("Windows")) {
Runtime.getRuntime().exec(
"rundll32 url.dll,FileProtocolHandler " + url);
} else {
String[] browsers = { "firefox", "opera", "konqueror", "epiphany",
"mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++) {
if (Runtime.getRuntime()
.exec(new String[] { "which", browsers[count] })
.waitFor() == 0) {
browser = browsers[count];
}
}
Runtime.getRuntime().exec(new String[] { browser, url });
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.