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

Ads
 

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 to pass class variable to another class
How can i pass the valus from a JSP to the action class???
Assigning a value to JSP variable from a bean class. - JSP-Servlet
how can we pass parameters from jsp href to another servlet
onclick pass variable - JSP-Servlet
how to pass an array from one jsp to another jsp - JSP-Servlet
How to pass javascript variable in Scriplet of JSP?
Pass parameters from JSP to Servlet
How to pass parametes from JSP page to HTML page? - JSP-Servlet
How to pass Array of string from action class to jsp page
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
How many ways we can pass the variable through the navigation between the pages?
how to pass arraylist data from one jsp to another jsp - JSP-Servlet
how to pass string array from action class to jsp page? pls reply me.
how to include a java class in jsp - JSP-Servlet
Pass a dom object from jsp to servlet
how to pass a string from one class to another
how to call a java class in jsp - JSP-Servlet
how to call a java class in jsp - JSP-Servlet
How I get a variable from java script to use it in the scriptlet of jsp.
Get values from JSP pages - JSP-Servlet
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 get session object in simple java class??
How to pass query as parameter? - JSP-Servlet
How to retrieve kernal memory details(paged and non-paged ) using SIGAR API in java program

Ads