• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can i passed parameter to flatfile(written in c++)?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i passed parameter to flatfile(written in c++),Fasta search Engine?
code:///
////////
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Hello World. This servlet simply says hi.
*
* <P> This is useful for testing the servlet configuration process,
* since this servlet isn't installed.
*/
public class FastaEngine extends HttpServlet {
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out;

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

String source=req.getParameter("S1");
String v =req.getParameter("libpo");
String databasename =req.getParameter("program");
//String v =req.getParameterValues("libpo");
out.println("<b>Getting the value from text box</b>");
out.println("<H1>"+v+"</H1>");
out.println("<H1>"+databasename+"</H1>");
//building string From various Option
//String command="D:/jithesh/sameer/"+databasename+" - "+ v+" ecoli3.txt ecoli3.txt";
String command="D:/jithesh/sameer/fasta -Q -O output d:/javaproject/ecoli3.txt d:/javaproject/mito.nt";
//D:\\jithesh\\sameer\\Fasta -q -o output salmo.txt swissport
out.println(command);
Date dd1=new Date(System.currentTimeMillis()-24*60*60*1000);
out.println("Time Started:"+dd1);
GregorianCalendar gc1 = new GregorianCalendar();
Date d1 = gc1.getTime();
long l1 = d1.getTime();
/* TAKING QUERY STRING FROM THE TEXT BOX AND WRITING TO THE FILE
OF NAME DEMO.TXT
CODE BEGAIN
*/
char buffer[]=new char[source.length()];
source.getChars(0,source.length(),buffer,0);
//FileReader fr =new FileReader("d:/javaproject/ShowFile.java");
FileWriter wr =new FileWriter("c:/demo2.txt");
for(int i=0;i<buffer.length;i++){
wr.write(buffer[i]);
}
wr.close();
//CODE OF FILE WRITING END.

String s="ASDFSDFDASF";
out.println("<html>");
out.println("<body bgcolor="+"#DBEDFF"+">");
out.println("<p>");
out.println("<hr noshade color="+"#FF0000"+">");
out.println("<H1>Readding The .Exe FileContent......</H1>");
out.println("</body></html>");

//Executing The File And Reading the File
//get Runtime it return the proccess
Runtime rt=Runtime.getRuntime();
//executing the exe file.
//Process pro=rt.exec("D:/jithesh/sameer/Fasta -o ecoli3.txt ecoli3.txt");
Process pro=rt.exec(command);
//reading the file content in byte stream
out.println("Executed");

InputStreamReader isr=new InputStreamReader(pro.getInputStream());
//Storing in the bufferreader.
BufferedReader br= new BufferedReader(isr);
String line;
//Reading the output Content...
while((line=br.readLine())!=null)
// out.println("<br>"+line+"</br>");
out.println("<font color=red><font size="+"1"+">"+"<br>"+line+"</font></br></font>");
GregorianCalendar gc2 = new GregorianCalendar();
Date d2 = gc2.getTime();
long l2 = d2.getTime();
long difference = l2 - l1;
out.println("Elapsed milliseconds: " + difference);

out.println("<html>");
out.println("<body bgcolor="+"#CCCCFF"+">");
out.println("<p>");
out.println("<hr noshade color="+"#FF0000"+">");

out.println("<b>"+"Hello World sameer ....."+source+"</b>");
out.println("<p><a href="+"http://localhost:8080/servlet/FastaOutput"+">see Result of Fasta Engine.....</a></p>");
out.println("</body></html>");
// res.sendRedirect("http://localhost:8080/servlet/RedirectServlet");
Date dd2=new Date(System.currentTimeMillis()-24*60*60*1000);
out.println("<br>TimeComPleted"+dd2+"</br>");
out.println("<br>Elapsed milliseconds: " + difference+"<br>");
}
}
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the servlet will need an Init() and a doPost() doGet() set of methods.
Just pick-up the parameter :
String value_to_pass = req.getParameter("xyz");
in the doPost method
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic