import java.io.IOException;
import java.util.Calendar;
-import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import compbio.cassandra.DataBase;
import compbio.statistic.StatisticsProt;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
- protected void doGet(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- List<DataBase> result;
- String flag = request.getParameter("option");
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String date1 = request.getParameter("data1");
String date2 = request.getParameter("data2");
StatisticsProt sp = new StatisticsProt();
- if (flag == null)
- result = sp.readLength(date1, date2);
- else {
+ if (null != request.getParameter("option")) {
Calendar cal = Calendar.getInstance();
- String dateB = StatisticsProt.DateFormatYYMMDD(sp.earliestDate());
- String dateEnd = cal.get(Calendar.YEAR) + "/"
- + (cal.get(Calendar.MONTH) + 1) + "/"
- + cal.get(Calendar.DAY_OF_MONTH);
- result = sp.readLength(dateB, dateEnd);
+ date1 = StatisticsProt.DateFormatYYMMDD(sp.earliestDate());
+ date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
}
request.setAttribute("data1", date1);
request.setAttribute("data2", date2);
- request.setAttribute("result", result);
- request.setAttribute("flag", flag);
- RequestDispatcher rd = request
- .getRequestDispatcher("/ReportLength.jsp");
+ request.setAttribute("result", sp.readLength(date1, date2));
+ request.setAttribute("flag", request.getParameter("option"));
+ RequestDispatcher rd = request.getRequestDispatcher("/ReportLength.jsp");
rd.forward(request, response);
}
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
- protected void doPost(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
package compbio.listeners;
import java.io.IOException;
-import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import compbio.cassandra.DataBase;
import compbio.statistic.StatisticsProt;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
- protected void doGet(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- List<DataBase> result;
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String flag = request.getParameter("protein");
String prot = request.getParameter("prot");
String checkbox = request.getParameter("option");
StatisticsProt sp = new StatisticsProt();
if (checkbox != null) {
- result = sp.readProtID();
+ request.setAttribute("result", sp.readProtID());
} else {
if (flag.equals("whole"))
- result = sp.readProt(prot);
+ request.setAttribute("result", sp.readProteins(prot));
else
- result = sp.readPart(prot);
+ request.setAttribute("result", sp.readPart(prot));
}
request.setAttribute("prot", prot);
request.setAttribute("flag", flag);
request.setAttribute("checkbox", checkbox);
- request.setAttribute("result", result);
RequestDispatcher rd = request.getRequestDispatcher("/ReportProt.jsp");
rd.forward(request, response);
}
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
- protected void doPost(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import compbio.cassandra.*;
+import compbio.cassandra.DataBase;
import compbio.statistic.StatisticsProt;
@WebServlet("/QueryServlet")
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- List<DataBase> result;
- String flag = request.getParameter("option");
String date1 = request.getParameter("data1");
String date2 = request.getParameter("data2");
StatisticsProt sp = new StatisticsProt();
- if (flag == null)
- result = sp.readDetail(date1, date2);
- else {
+ if (null != request.getParameter("option")) {
Calendar cal = Calendar.getInstance();
- String dateB = StatisticsProt.DateFormatYYMMDD(sp.earliestDate());
- String dateEnd = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
- result = sp.readDetail(dateB, dateEnd);
+ date1 = StatisticsProt.DateFormatYYMMDD(sp.earliestDate());
+ date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH);
}
request.setAttribute("data1", date1);
request.setAttribute("data2", date2);
- request.setAttribute("result", result);
- request.setAttribute("flag", flag);
+ List<DataBase> res = sp.readDetails(date1, date2);
+ request.setAttribute("result", res);
+ System.out.println ("QueryServlet.doGet: total number of dates = " + res.size());
+ request.setAttribute("flag", request.getParameter("option"));
RequestDispatcher rd = request.getRequestDispatcher("/ReportNew.jsp");
rd.forward(request, response);
}