I have a peculiar business case where I am trying to pass parameters(both variables and arrays) from a java class to a servlet and invoke a servlet from the java class.
What I did is, just made the parameters global assigned their values inside the java class and then invoked the servlet from the Java class. But this doesn't seem to be good idea.
Hers is my sample code:
/* Assigning all the variables and array values inside a java class */
JavaClass.java
...
var1 = value1;
var2 = value2;
arr1 = {val1, val1, val3};
...
I am referring URLCOnnection in Oracle's documentation found here
The thing is I m not understanding the way in which we can send the parameters.
URL url = new URL("http://localhost:8080/ProjectCharterApproval2/CharterApprover");
URLConnection connection = url.openConnection() ;
connection.setDoOutput(true);
/** After this how should I pass parameter to the servlet as an input object or output object ? **/
Any help will highly be appreciated.
Thanks in advance.