Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass parameter from Java Application to Servlet

Status
Not open for further replies.

yytan

Programmer
May 8, 2002
113
MY
hi there;

i am doing a "JAVA APPLICATION" to retrieve mandatory data from oracle database. (ie, from table - customer, fields - name, age, addr....)

i would like to pass these data to the "SERVLET" in order to do other processing.

i am doing this in my java application, but doesnt work?

private void getURL() throws Exception {

URL url;
URLConnection urlCon;

try {
url = new URL("
//urlCon = url.openConnection();
System.out.println("url = " + url.toString());
System.out.println("url ok.");
}
catch(MalformedURLException mue){
System.out.println("RepDailyTxn-getURL : " + mue);
}

}

may i know how to do that? any method i can refer to? thanks in advance.
 
the problem is, taht for some reason you need to read the answer, too. Just try the following:

URLConnection conn = url.openConnection();
conn.connect();
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inb = new String("");
StringBuffer sb = new StringBuffer();
while ((inb = br.readLine()) != null) {
sb.append(inb+"\n");
}
 
hi there;

i am wondering whether can call servlet from my java app. program?

let say in dos promp i type:

> c:\ java TReport

then it will conn to db and retrieve field from db
after that, i want to pass the data to servlet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top