how to call servlet from java(URGent !!!!!!!!1)
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sudhanshu_jain
Posted On:   Thursday, October 11, 2007 10:21 AM

Is it right approach to call servlet from java ............................................... if you find any mistake please let me know..... public String univadisAuthentication(String uname,String pwd,String call,String error,String actionur) { String Username=uname; String Password=pwd; String caller=call; String errorURL=error; String ActionURL=actionur; String url1=""; try { URL url = new URL(ActionURL+"?Username="+Username+"&Password="+Password+"&caller="+caller+"&errorURL="+errorURL+" "); //URL url = new URL(ActionURL); //Http   More>>

Is it right approach to call servlet from java
...............................................

if you find any mistake please let me know.....


public String univadisAuthentication(String uname,String pwd,String call,String error,String actionur)
{

String Username=uname;
String Password=pwd;
String caller=call;
String errorURL=error;
String ActionURL=actionur;
String url1="";


try
{

URL url = new URL(ActionURL+"?Username="+Username+"&Password="+Password+"&caller="+caller+"&errorURL="+errorURL+"
");
//URL url = new URL(ActionURL);
//HttpURLConnection con = (HttpURLConnection)url.openConnection();
//con.setRequestMethod("POST");

URLConnection conn=url.openConnection();
url1=conn.toString();

conn.setDoOutput(true);
conn.setDoInput(true);

//OutputStreamWriter ostream=new OutputStreamWriter(conn.getOutputStream());
//BufferedWriter out=new BufferedWriter(ostream);
//out.write("Username="+Username+"&Password="+Password+"&caller="+caller+"&errorURL="+errorURL+"
");

//out.flush();
//out.close();
//URLConnection ur=new URLConnection(url);
//con.connect();




/*univadisAuthentication post = new univadisAuthentication();
post.u = new URL(ActionURL+"?Username="+Username+"&Password="+Password+"&caller="+caller+"&errorURL="+errorURL);
url1=post.u.toString();
// Open the connection and prepare to POST
URLConnection uc = u.openConnection();

uc.setDoOutput(true);
uc.setDoInput(true);
uc.setAllowUserInteraction(false);*/




}
catch(MalformedURLException e)
{
e.printStackTrace();
}
catch ( IOException ex )
{
// a real program would need to handle this exception
}

return url1;
}

   <<Less

Re: how to call servlet from java(URGent !!!!!!!!1)

Posted By:   Stephen_McConnell  
Posted On:   Sunday, October 28, 2007 01:50 PM

Please, reformat this code with the >code<>/code< tags and maybe someone might read it.


I've just started with Java on the AS/400, but have been programming java for over 8 years... If I could read this code, then, I might dig through it to figure out your problem.

About | Sitemap | Contact