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









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?
Assigning a value to JSP variable from a bean class. - JSP-Servlet
How can i pass the valus from a JSP to the action class???
onclick pass variable - JSP-Servlet
how to pass class variable to another class
how can we pass parameters from jsp href to another servlet
how to pass an array from one jsp to another jsp - JSP-Servlet
Pass parameters from JSP to Servlet
How to pass parametes from JSP page to HTML page? - JSP-Servlet
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 pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
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.
Get values from JSP pages - JSP-Servlet
How many ways we can pass the variable through the navigation between the pages?
how to include a java class in jsp - JSP-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.
How to pass the value from controller to jsp page ?
How to pass query as parameter? - JSP-Servlet
How to pass and catch HTML parameters to a Java program using REST services?(without using servlet/jsp)
variable setting for servlet - JSP-Servlet
how to call jsp variable through servlet
Java from JSP - JSP-Servlet
How do you pass a variable by value?
Converting jsp variable to java variable
How to get jSon object in servlet from jsp - JSP-Servlet
convert javascript var to java variable - JSP-Servlet
Pass value of rasio button from jsp page to action class(not conventional problem)
how to pass form values from javascript of html page to jsp page
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page
how to value of one variable pass in other variable in revetse order
How to call jasper from jsp or servlet - JSP-Servlet
Extracting variable from jsp
calling servlet from jsp
variable for cookie.setDomain - JSP-Servlet
how to get session object in simple java class??
How to carry multiple values from a Servlet to a JSP?
how to convert jsp page to class file - JSP-Servlet
How to retrieve kernal memory details(paged and non-paged ) using SIGAR API in java program

Ads