Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: "Some queery about servlet chaining"


Message #1 by Bikash Paul <bikashpaul_2001@y...> on Fri, 8 Jun 2001 04:40:17 -0700 (PDT)
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:\bea\jdk130\bin;
set classpath=e:\soft dumps\saxon\saxon.jar;e:\soft
dumps\saxon\saxon-fop.jar;
java com.icl.saxon.StyleSheet c:\todo.xml c:\todo.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

  Return to Index