"Some query about servlet chaining"
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   bikash_paul
Posted On:   Friday, June 8, 2001 03:15 AM

Dear Sir, Can u guide me how I create chaining between two servlets in weblogic6.0. I want output of my 1st servlet becomes input of my 2nd servlet.Can u try with my codes.Any help will be highly appreciated. Note:-My 1st servlet creating a html file from xml.And 2nd servlet creating .rb file from html file. Following r my codes:- It is my 1st servlet:- ----------------------- import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class Example8 extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { res.setContentTyp   More>>

Dear Sir,

Can u guide me how I create chaining between two servlets in weblogic6.0.
I want output of my 1st servlet becomes input of my 2nd servlet.Can u try with my codes.Any help will be highly appreciated.
Note:-My 1st servlet creating a html file from xml.And 2nd servlet creating .rb file from html file.
Following r my codes:-
It is my 1st servlet:-
-----------------------
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Example8 extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{

res.setContentType("text/html");
PrintWriter out=res.getWriter();

Runtime r = Runtime.getRuntime();
Process p=null;
try
{
p=r.exec("c:\saxon.bat");
BufferedReader in=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=null;
while((line=in.readLine()) !=null)
{
out.println(line);
}
}
catch(Exception e)
{
out.println("Error from execution" + e.toString());
}


}

}

In my saxon .bat:-
--------------------
(set path=c: eajdk130 in;
set classpath=e:soft dumpssaxonsaxon.jar;e:soft dumpssaxonsaxon-fop.jar;
java com.icl.saxon.StyleSheet c: odo.xml c: odo.xsl >c:check8.html)

It is my 2nd servlet:-
-----------------------
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Example7 extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{

res.setContentType("text/html");
PrintWriter out=res.getWriter();
Runtime r = Runtime.getRuntime();
Process p=null;
try
{
p=r.exec("e:\soft dumps\rbmake\rbmake -o test4 c:\check.html");
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=null;
while((line=in.readLine()) !=null)
{
out.println(line);
}
}
catch(Exception e)
{
out.println("Error from execution" + e.toString());
}


}

}

With Regards
BIKASH

   <<Less

Re: &quot;Some query about servlet chaining&quot;

Posted By:   Shawn_Bailey  
Posted On:   Monday, November 12, 2001 02:40 PM

I have two suggestions that may work for you. The first one is to treat the Servlet that creates HTML from XML as a File that is referenced by its URL. By that the input you are using is something like this:

InputString yourinput = new URL("http://where-you-are/servlet/yourservlet").openStream();


The other method that you could try is to make the first servlet a JavaBean and then you can take its output directly through a String. Hope this helps.
About | Sitemap | Contact