how to pass variable from simple java main class(not servlet) to the jsp page?

how to pass variable from simple java main class(not servlet) to the jsp page?

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 });
    }
}
View Answers

Ads









Related Tutorials/Questions & Answers:
how to pass variable from simple java main class(not servlet) to the jsp page?
How to pass variable from one class to another in java
Advertisements
How to pass an arraylist from servlet to jsp?
How to pass multiple values from a servlet to JSP?
How can i pass the valus from a JSP to the action class???
How to pass javascript variable in Scriplet of JSP?
How to pass Array of string from action class to jsp page
Pass a dom object from jsp to servlet
how to include a java class in jsp - JSP-Servlet
how to pass string array from action class to jsp page? pls reply me.
how to pass a string from one class to another
How I get a variable from java script to use it in the scriptlet of jsp.
How to pass the value from controller to jsp page ?
How to pass and catch HTML parameters to a Java program using REST services?(without using servlet/jsp)
How to carry multiple values from a Servlet to a JSP?
calling servlet from jsp
Converting jsp variable to java variable
Pass value of rasio button from jsp page to action class(not conventional problem)
how to get session object in simple java class??
Extracting variable from jsp
how to value of one variable pass in other variable in revetse order
How display a image on servlet from file upload - JSP-Servlet
how to assign javascript variable value to a jsp variable
How to display image in jsp from database using Servlet?
Getting Parameter from a css styled jsp file to a java servlet file...
How to retrieve image from database using jsp and servlet?
how to make authentication for each user using jsp/servlet?
Passing java variables from JSP to Servlet - return null values
Getting Json data from servlet to javascript variable
How to get the data from the database using Servlet or JSP program
How to display Jfreechart from servlet in jsp web page at specified location

Ads