×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Example

本文发表在 rolia.net 枫下论坛import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class download extends HttpServlet{

public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException {

request.setAttribute("download", "Y");
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/_ScriptLibrary/function.jsp");
dispatcher.include(request,response);
if (request.getAttribute("status") != null) {
response.sendRedirect(request.getAttribute("status").toString());
return;
}

int LIMIT = Integer.parseInt(getServletContext().getInitParameter("numSongs"));
String STATUS = getServletContext().getInitParameter("ftpDisabled");
//getting form vbl titleid.
String TITLEID = request.getParameter("TITLEID");
int DOWNLOAD = Integer.parseInt(request.getParameter("DOWNLOAD"));

if (STATUS.equals("Y")) {
printErr(response,LIMIT);
return;
}

updateSQL(TITLEID, DOWNLOAD);

if (updateCookies(request,response,LIMIT)) {
gotoPage(TITLEID, request, response);
}
}更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 请教 : client side form METHOD=POST , how do the server side GenericServlet to get a variable from client ? THANKS!
    • Try winHTTP or XMLHTTP......
    • extends HttpServlet
      When your servlet extends HttpServlet, it calls method HttpRequest.getParameter(..) in doPost(...) to get what you want.
    • Example
      本文发表在 rolia.net 枫下论坛import java.sql.*;
      import javax.servlet.*;
      import javax.servlet.http.*;
      import java.io.*;

      public class download extends HttpServlet{

      public void doPost(HttpServletRequest request,HttpServletResponse response)
      throws ServletException,IOException {

      request.setAttribute("download", "Y");
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/_ScriptLibrary/function.jsp");
      dispatcher.include(request,response);
      if (request.getAttribute("status") != null) {
      response.sendRedirect(request.getAttribute("status").toString());
      return;
      }

      int LIMIT = Integer.parseInt(getServletContext().getInitParameter("numSongs"));
      String STATUS = getServletContext().getInitParameter("ftpDisabled");
      //getting form vbl titleid.
      String TITLEID = request.getParameter("TITLEID");
      int DOWNLOAD = Integer.parseInt(request.getParameter("DOWNLOAD"));

      if (STATUS.equals("Y")) {
      printErr(response,LIMIT);
      return;
      }

      updateSQL(TITLEID, DOWNLOAD);

      if (updateCookies(request,response,LIMIT)) {
      gotoPage(TITLEID, request, response);
      }
      }更多精彩文章及讨论,请光临枫下论坛 rolia.net