/** * Creates a Discussion Post * * <p>- Requires a cookie for the session user - Requires a comment and threadId request parameter * for the POST * * @param req The HTTP Request * @param res The HTTP Response */ public void createPostAction(HttpServletRequest req, HttpServletResponse res) { // Ensure there is a cookie for the session user if (AccountController.redirectIfNoCookie(req, res)) return; Map<String, Object> viewData = new HashMap<>(); if (req.getMethod() == HttpMethod.Post) { DiscussionManager dm = new DiscussionManager(); HttpSession session = req.getSession(); Session userSession = (Session) session.getAttribute("userSession"); // Create the discussion post DiscussionPost post = new DiscussionPost(); post.setUserId(userSession.getUserId()); post.setMessage(req.getParameter("comment")); post.setThreadId(Integer.parseInt(req.getParameter("threadId"))); dm.createPost(post); redirectToLocal(req, res, "/group/discussion/?threadId=" + req.getParameter("threadId")); } else { httpNotFound(req, res); } }
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String script = request.getParameter("bsh.script"); String client = request.getParameter("bsh.client"); String output = request.getParameter("bsh.servlet.output"); String captureOutErr = request.getParameter("bsh.servlet.captureOutErr"); boolean capture = false; if (captureOutErr != null && captureOutErr.equalsIgnoreCase("true")) capture = true; Object scriptResult = null; Exception scriptError = null; StringBuffer scriptOutput = new StringBuffer(); if (script != null) { try { scriptResult = evalScript(script, scriptOutput, capture, request, response); } catch (Exception e) { scriptError = e; } } response.setHeader("Bsh-Return", String.valueOf(scriptResult)); if ((output != null && output.equalsIgnoreCase("raw")) || (client != null && client.equals("Remote"))) sendRaw(request, response, scriptError, scriptResult, scriptOutput); else sendHTML(request, response, script, scriptError, scriptResult, scriptOutput, capture); }
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); String support = "support"; // valid username HttpSession session = null; session = req.getSession(false); // Get user's session object (no new one) if (session == null) { invalidUser(out); // Intruder - reject return; } String userName = (String) session.getAttribute("user"); // get username if (!userName.equals(support)) { invalidUser(out); // Intruder - reject return; } String action = ""; if (req.getParameter("todo") != null) action = req.getParameter("todo"); if (action.equals("update")) { doUpdate(out); return; } out.println("<p>Nothing to do.</p>todo=" + action); }
private void setHttpRequestStockPlace(HttpServletRequest request, OutMgr outMgr) { outMgr.setCurrentInventoryPlace(request.getParameter("place")); outMgr.setLocationPlace( (LocationPlace) Utility.getObject( outMgr.getStockPlaceMeta().getStockPlaceList(), request.getParameter("place"))); }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { response.setContentType("text/html"); PrintWriter out = response.getWriter(); /*String n=request.getParameter("username"); out.print("Welcome "+n);*/ String name = request.getParameter("name"); String dob = request.getParameter("dob"); String address = request.getParameter("address"); String email = request.getParameter("email"); HttpSession session = request.getSession(true); String userid = (String) session.getAttribute("theName"); int AccNo = 0; String AccMsg = ""; DbCommunication db_comm = new DbCommunication(); AccNo = db_comm.accountCreation(name, dob, address, email, userid); // db_comm.accountCreation(name,email); AccMsg = "Account created successfully. Account number is:" + AccNo; // out.println(AccMsg); String redirectURL = "accountCreationPage.jsp"; response.sendRedirect(redirectURL); session.setAttribute("AccCreationalMsgStatus", "set"); session.setAttribute("AccCreationalMsg", AccMsg); } catch (Exception e) { System.out.println(e); } }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String amount = request.getParameter("amount"); String amount2 = request.getParameter("amount2"); String amount3 = request.getParameter("amount3"); Integer posotita = Integer.parseInt(amount); Integer posotita2 = Integer.parseInt(amount2); Integer posotita3 = Integer.parseInt(amount3); HttpSession session = request.getSession(); if (session.isNew()) { request.setAttribute("sessionVal", "this is a new session"); } else { request.setAttribute("sessionVal", "Welcome Back!"); } double total = ((posotita * 18.50) + (posotita2 * 6.95) + (posotita3 * 1.29)); session.setAttribute("totalVal", total); request.setAttribute("currency", total); request.setAttribute("from", amount); request.setAttribute("from2", amount2); request.setAttribute("from3", amount3); RequestDispatcher view = request.getRequestDispatcher("index.jsp"); view.forward(request, response); }
/** * 判断是否需要必须录入合同金额 * * @param request * @param response * @return * @throws Exception */ private String calNeedInputMoney(HttpServletRequest request, HttpServletResponse response) throws Exception { String xml = null; String company_id = JUtil.convertNull(request.getParameter("company_id")); String exter_contract_type = JUtil.convertNull(request.getParameter("exter_contract_type")); String need_con_money = "0"; xml = "<?xml version='1.0' encoding='gbk'?>\n"; org.jdom.Element eleRoot = new org.jdom.Element("root"); org.jdom.Element eleNeed = new org.jdom.Element("need_con_money"); try { List<ExterContractType> lsType = ExterContractType.getContractTypeByCompany(company_id); for (ExterContractType type : lsType) { if (type.getCon_type_id().equals(exter_contract_type)) { if (type.getNeed_con_money() == 1) { need_con_money = "1"; } break; } } eleNeed.setAttribute("need_con_money", need_con_money); eleRoot.addContent(eleNeed); org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter(); xml += xmlout.outputString(eleRoot); JLog.getLogger().debug("xml=\n" + xml); return xml.trim(); } catch (Exception e) { JLog.getLogger().error("", e); } return ""; }
/** * 根据公司ID,获得对外合同申请的合同类别 取公司对应的合同类型 如公司为空,则取所有 * * @param request * @param response * @return * @throws Exception */ private String calExterContractApplyType(HttpServletRequest request, HttpServletResponse response) throws Exception { String xml = null; String company_id = JUtil.convertNull(request.getParameter("company_id")); String defalut_type = JUtil.convertNull(request.getParameter("defalut_type")); xml = "<?xml version='1.0' encoding='gbk'?>\n"; org.jdom.Element eleRoot = new org.jdom.Element("root"); org.jdom.Element defalutType = new org.jdom.Element("defalut_type"); defalutType.setAttribute("defalut_type", defalut_type); eleRoot.addContent(defalutType); org.jdom.Element eleRows = new org.jdom.Element("contract_types"); eleRoot.addContent(eleRows); org.jdom.Element eleRow = null; try { List<ExterContractType> lsType = ExterContractType.getContractTypeByCompany(company_id); for (ExterContractType type : lsType) { eleRow = new org.jdom.Element("contract_type"); eleRow.setAttribute("con_type_id", type.getCon_type_id()); eleRow.setAttribute("con_type_name", type.getCon_type_name()); eleRows.addContent(eleRow); } org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter(); xml += xmlout.outputString(eleRoot); JLog.getLogger().debug("xml=\n" + xml); return xml.trim(); } catch (Exception e) { JLog.getLogger().error("", e); } return ""; }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); HttpSession session = request.getSession(); String username = request.getParameter("username"); String password = request.getParameter("password"); String type = request.getParameter("type"); System.out.println(username + password + type); session.setAttribute("user", username); try { writer.println("<html>"); writer.println("<body bgcolor=green>"); writer.println("<center>"); ps.setString(1, username); ps.setString(2, password); ps.setString(3, type); ResultSet rs = ps.executeQuery(); if (rs.next()) { writer.println("<h1>LOGIN SUCCESSFUL</h1><br><br>"); writer.println("<a href=account.html>click here to see your account</a>"); } else { writer.println("<h1>LOGIN FAILED</h1><br><br>"); writer.println("<a href=login.html>click here to login again</a>"); } writer.println("</center>"); writer.println("</body>"); writer.println("</html>"); } catch (Exception e) { e.printStackTrace(); } }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // POST method only used for tracked login operation HttpSession session = request.getSession(); response.setContentType("text/plain"); PrintWriter out = response.getWriter(); // Get the username and password from request String username = request.getParameter("id"); String password = request.getParameter("pwd"); Long id = 0L; try { id = Long.parseLong(username); } catch (Exception ex) { } if (username != null && password != null) { // Login into tracked system CTracked ctracked = db.loginTrackedFromMobile(id, password).getResult(); if (ctracked != null) { // Login successful out.print("OK," + ctracked.getUsername()); session.setAttribute("device_id", ctracked.getUsername()); log.info(ctracked + " : logined!"); } } }
public void summaryAction(HttpServletRequest req, HttpServletResponse res) { if (AccountController.redirectIfNoCookie(req, res)) return; Map<String, Object> viewData = new HashMap<String, Object>(); DocumentManager docMan = new DocumentManager(); try { if (req.getParameter("documentId") != null) { // Get the document ID int docId = Integer.parseInt(req.getParameter("documentId")); // Get the document using document id Document document = docMan.get(docId); // Set title to name of the document viewData.put("title", document.getDocumentName()); // Create List of access records List<AccessRecord> accessRecords = new LinkedList<AccessRecord>(); // Add access records for document to the list accessRecords = docMan.getAccessRecords(docId); viewData.put("accessRecords", accessRecords); } else { // Go back to thread page. } } catch (Exception e) { Logger.getLogger("").log(Level.SEVERE, "An error occurred when getting profile user", e); } view(req, res, "/views/group/Document.jsp", viewData); }
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ProfesorRepository profesores = (ProfesorRepository) context.getBean("profesorRepository"); try { String id = request.getParameter("id"); int idProf = Integer.parseInt(id); String cedula = request.getParameter("cedula"); String nombre = request.getParameter("nombre"); String titulo = request.getParameter("titulo"); String area = request.getParameter("area"); String telefono = request.getParameter("telefono"); Profesor prof = profesores.findProfesor(idProf); try { if (cedula != null) prof.setCedula(cedula); if (nombre != null) prof.setNombre(nombre); if (titulo != null) prof.setTitulo(titulo); if (area != null) prof.setArea(area); if (telefono != null) prof.setTelefono(telefono); profesores.updateProfesor(prof); } catch (Exception e) { } response.sendRedirect("listaProfesores"); } catch (Exception e) { request.setAttribute("mensaje", e.getMessage()); forward("/paginaError.jsp", request, response); } }
/** * 获得对外合同申请的默认审批人 * * @param request * @param response * @return * @throws Exception */ private String calDefaultExterContractApprover( HttpServletRequest request, HttpServletResponse response) throws Exception { String xml = null; String company_id = JUtil.convertNull(request.getParameter("company_id")); String con_type = JUtil.convertNull(request.getParameter("con_type")); String con_money_str = JUtil.convertNull(request.getParameter("con_money")); String apply_user_id = JUtil.convertNull(request.getParameter("apply_user_id")); Double con_money = null; if (con_money_str.length() > 0) { try { con_money = Double.parseDouble(con_money_str); } catch (Exception e) { } } xml = "<?xml version='1.0' encoding='gbk'?>\n"; org.jdom.Element eleRoot = new org.jdom.Element("root"); org.jdom.Element eleRows = new org.jdom.Element("users"); eleRoot.addContent(eleRows); org.jdom.Element eleRow = null; try { Map<String, JUser> mapUser = null; if (company_id.length() > 0 && con_type.length() > 0) { boolean need_con_money = false; List<ExterContractType> lsType = ExterContractType.getContractTypeByCompany(company_id); for (ExterContractType type : lsType) { if (type.getCon_type_id().equals(con_type)) { if (type.getNeed_con_money() == 1) { need_con_money = true; } break; } } if (!need_con_money || con_money != null) { mapUser = ExterContractApply.getDefaultApprover( company_id, con_type, con_money == null ? 0 : con_money, apply_user_id); } } if (mapUser != null) { for (String userId : mapUser.keySet()) { JUser user = mapUser.get(userId); if (user == null) continue; eleRow = new org.jdom.Element("user"); eleRow.setAttribute("user_id", user.getUserId()); eleRow.setAttribute("user_name", user.getUserName()); eleRows.addContent(eleRow); } } org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter(); xml += xmlout.outputString(eleRoot); JLog.getLogger().debug("xml=\n" + xml); return xml.trim(); } catch (Exception e) { JLog.getLogger().error("", e); } return ""; }
/** * The method redirects the user to the authentication module if he is not authenticated; else * redirects him back to the original referrer. * * @param request an HttpServletRequest object that contains the request the client has made of * the servlet. * @param response an HttpServletResponse object that contains the response the servlet sends to * the client. * @exception ServletException if an input or output error is detected when the servlet handles * the GET request * @exception IOException if the request for the GET could not be handled */ private void doGetPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (debug.messageEnabled()) { debug.message( "CDCClientServlet.doGetPost:Query String received= " + request.getQueryString()); } String gotoParameter = request.getParameter(GOTO_PARAMETER); String targetParameter = request.getParameter(TARGET_PARAMETER); if (targetParameter == null) { targetParameter = request.getParameter(TARGET_PARAMETER.toLowerCase()); } // if check if goto ot target have invalid strings, to avoid // accepting invalid injected javascript. if ((gotoParameter != null) || (targetParameter != null)) { if (debug.messageEnabled()) { debug.message( "CDCClientServlet:doGetPost():validating goto: " + gotoParameter + " and target: " + targetParameter); } for (String invalidStr : INVALID_SET) { if (gotoParameter != null && gotoParameter.toLowerCase().contains(invalidStr)) { showError(response, SERVER_ERROR_STR_MATCH + "GOTO parameter has invalid characters"); return; } if (targetParameter != null && targetParameter.toLowerCase().contains(invalidStr)) { showError(response, SERVER_ERROR_STR_MATCH + "TARGET parameter has invalid characters"); return; } } } /* Steps to be done * 1. If no SSOToken or policy advice present , forward to * authentication. * 2. If SSOToken is valid tunnel request to the backend AM's * CDCServlet and Form POST the received response to the agent. */ // Check for a valid SSOToken in the request. If SSOToken is not found // or if the token is invalid, redirect the user for authentication. // Also re-direct if there are policy advices in the query string SSOToken token = getSSOToken(request, response); // collect advices in parsedRequestParams[0] String and rest of params // other than original goto url in parsedRequestParams[1] String. String[] parsedRequestParams = parseRequestParams(request); if ((token == null) || (parsedRequestParams[0] != null)) { // Redirect to authentication redirectForAuthentication(request, response, parsedRequestParams[0], parsedRequestParams[1]); } else { // tunnel request to AM // send the request to the CDCServlet of AM where the session // was created. sendAuthnRequest(request, response, token); } }
/** * The method redirects the user to the authentication module if he is not authenticated; else * redirects him back to the original referrer. * * @param request an HttpServletRequest object that contains the request the client has made of * the servlet. * @param response an HttpServletResponse object that contains the response the servlet sends to * the client. * @exception ServletException if an input or output error is detected when the servlet handles * the GET request * @exception IOException if the request for the GET could not be handled */ private void doGetPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (debug.messageEnabled()) { debug.message( "CDCClientServlet.doGetPost:Query String received= " + request.getQueryString()); } String gotoParameter = request.getParameter(GOTO_PARAMETER); String targetParameter = request.getParameter(TARGET_PARAMETER); if (targetParameter == null) { targetParameter = request.getParameter(TARGET_PARAMETER.toLowerCase()); } // if check if goto ot target have invalid strings, to avoid // accepting invalid injected javascript. if ((gotoParameter != null) || (targetParameter != null)) { debug.message("CDCServlet:doGetPost():goto or target is not null"); for (Iterator it = invalidSet.iterator(); it.hasNext(); ) { String invalidStr = (String) it.next(); if ((gotoParameter != null) && (gotoParameter.toLowerCase().indexOf(invalidStr) != -1)) { showError(response, "GOTO parameter has invalid " + "characters"); return; } if ((targetParameter != null) && (targetParameter.toLowerCase().indexOf(invalidStr) != -1)) { showError(response, "TARGET parameter has invalid " + "characters"); return; } } } /* Steps to be done * 1. If no SSOToken or policy advice present , forward to * authentication. * 2. If SSOToken is valid tunnel request to the backend AM's * CDCServlet and Form POST the received response to the agent. */ // Check for a valid SSOToken in the request. If SSOToken is not found // or if the token is invalid, redirect the user for authentication. // Also re-direct if there are policy advices in the query string SSOToken token = getSSOToken(request, response); if (token == null) { policyAdviceList = null; } // collect advices in policyAdviceList String and rest of params // other than original goto url in "requestParams" String. parseRequestParams(request); if ((token == null) || (policyAdviceList != null)) { // Redirect to authentication redirectForAuthentication(request, response); } else { // tunnel request to AM // send the request to the CDCServlet of AM where the session // was created. sendAuthnRequest(request, response, token); } }
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EstacionBombeoModule module = (EstacionBombeoModule) context.getBean("estacionBombeoModule"); try { String presionSalida = request.getParameter("presionSalida"); int presionSalidaObj = Integer.parseInt(presionSalida); String presionEntrada = request.getParameter("presionEntrada"); int presionEntradaObj = Integer.parseInt(presionEntrada); String cantidadBombas = request.getParameter("cantidadBombas"); int cantidadBombasObj = Integer.parseInt(cantidadBombas); String capacidadMaxima = request.getParameter("capacidadMaxima"); int capacidadMaximaObj = Integer.parseInt(cantidadBombas); String idAcueducto = request.getParameter("idAcueducto"); int idAcueductoObj = Integer.parseInt(idAcueducto); String encargado = request.getParameter("encargado"); String tipo = request.getParameter("tipo"); String telefono = request.getParameter("telefono"); String nombreEstacion = request.getParameter("nombreEstacion"); module.insertar( presionSalidaObj, tipo, capacidadMaximaObj, cantidadBombasObj, encargado, telefono, presionEntradaObj, idAcueductoObj, nombreEstacion); response.sendRedirect("listaEstacionBombeos"); } catch (Exception e) { request.setAttribute("mensaje", e.getMessage()); forward(e.getMessage(), request, response); } }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String key = request.getParameter("keyname"); String keyvalue = request.getParameter("value"); // Add the task to the default queue. Queue queue = QueueFactory.getDefaultQueue(); queue.add( TaskOptions.Builder.withUrl("/worker").param("keyname", key).param("value", keyvalue)); response.sendRedirect("/done.html"); }
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.apache.jasper.runtime.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write('\n'); out.write('\n'); out.write("\n<!DOCTYPE html>\n<html>\n<head>\n"); JspHelper.createTitle(out, request, request.getParameter("filename")); out.write("\n</head>\n<body onload=\"document.goto.dir.focus()\">\n"); Configuration conf = (Configuration) getServletContext().getAttribute(JspHelper.CURRENT_CONF); generateFileChunks(out, request, conf); out.write("\n<hr>\n"); generateFileDetails(out, request, conf); out.write("\n\n<h2>Local logs</h2>\n<a href=\"/logs/\">Log</a> directory\n\n"); out.println(ServletUtil.htmlFooter()); out.write('\n'); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // get parameters from the request String strSelectedDNBNumbers = request.getParameter("dunsnbr"); String strAction = request.getParameter("view"); String url = ""; url = "/TreeView?dunsnbr=" + strSelectedDNBNumbers + "&output=text"; // forward the request and response to the view RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); }
public boolean processParams(HttpServletRequest request) { try { if (request.getParameter("case") != null) { tc = request.getParameter("case"); } return true; } catch (Exception ex) { System.err.println("Exception when processing the request params"); ex.printStackTrace(); return false; } }
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String cmd = request.getParameter(CMD); if (null != cmd) { if (cmd.equalsIgnoreCase(GET_STUDY_STATISTICS_CMD)) { String type = request.getParameter(GET_STUDY_STATISTICS_TYPE); processRequestStatistics(request, response, type); return; } } processRequestDefault(request, response); }
void doGiveHint(HanabiGame game, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException, HanabiException { String target = req.getParameter("target"); String hint = req.getParameter("hint"); game.giveHint(target, hint); JsonGenerator out = new JsonFactory().createJsonGenerator(resp.getOutputStream()); out.writeStartObject(); out.writeStringField("message", "hint given; " + game.hintsLeft + " hints left"); out.writeEndObject(); out.close(); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); HttpSession session = request.getSession(); // TODO: add code that gets the User object from the session and updates the database String url = "/displayUsers"; RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); }
private boolean validate(HttpServletRequest request) throws DaoException { String cancerStudyID = request.getParameter(ID); if (cancerStudyID == null) { cancerStudyID = request.getParameter(QueryBuilder.CANCER_STUDY_ID); } CancerStudy cancerStudy = DaoCancerStudy.getCancerStudyByStableId(cancerStudyID); if (cancerStudy == null) { try { cancerStudy = DaoCancerStudy.getCancerStudyByInternalId(Integer.parseInt(cancerStudyID)); } catch (NumberFormatException ex) { } } if (cancerStudy == null) { request.setAttribute(ERROR, "No such cancer study"); return false; } String cancerStudyIdentifier = cancerStudy.getCancerStudyStableId(); if (accessControl.isAccessibleCancerStudy(cancerStudyIdentifier).size() != 1) { request.setAttribute( ERROR, "You are not authorized to view the cancer study with id: '" + cancerStudyIdentifier + "'. "); return false; } else { UserDetails ud = accessControl.getUserDetails(); if (ud != null) { logger.info("CancerStudyView.validate: Query initiated by user: "******"_all"; request.setAttribute(QueryBuilder.CASE_SET_ID, sampleListId); } SampleList sampleList = daoSampleList.getSampleListByStableId(sampleListId); if (sampleList == null) { request.setAttribute(ERROR, "Could not find sample list of '" + sampleListId + "'. "); return false; } request.setAttribute(QueryBuilder.CASE_IDS, sampleList.getSampleList()); request.setAttribute(CANCER_STUDY, cancerStudy); request.setAttribute(QueryBuilder.HTML_TITLE, cancerStudy.getName()); return true; }
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if ("true".equals(req.getParameter("is_return"))) { processReturn(req, resp); } else { String identifier = req.getParameter("openid_identifier"); if (identifier != null) { this.authRequest(identifier, req, resp); } else { // this.getServletContext().getRequestDispatcher("/openid/login.xql").forward(req, resp); resp.sendRedirect(OpenIDRealm.instance.getSecurityManager().getAuthenticationEntryPoint()); } } }
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { // res.setContentType("text/html"); // PrintWriter pw = res.getWriter(); // pw.println("Beer selection advice<br/>"); BeerExpert be = new BeerExpert(); String c = req.getParameter("color"); List result = be.getBrands(c); req.setAttribute("styles", result); String email = getServletConfig().getInitParameter("adminEmail"); RequestDispatcher view = req.getRequestDispatcher("result.jsp"); // try{ view.forward(req, res); // } catch (Exception e) { // System.out.println("some thing wrong in view.forward"); // e.printStackTrace(); // } // Iterator it = result.iterator(); // while(it.hasNext()){ // pw.println("<br/> tyr: " + it.next()); // } }
public void doGet(HttpServletRequest rq, HttpServletResponse rs) { PrintWriter pw = null; try { pw = rs.getWriter(); rs.setContentType("application/json"); OperatorBLInterface operatorInterface = new Operator(); LoyaltyApplication loyaltyApplication = new LoyaltyApplication(); boolean found = loyaltyApplication.operatorExists(Integer.parseInt(rq.getParameter("code"))); pw.println("{"); pw.println("\"success\":true,"); pw.println("\"found\":" + found); pw.println("}"); } catch (ApplicationException ae) { System.out.println(ae); pw.println("{"); pw.println("\"success\":false,"); pw.println("\"errorMessage\":" + "\"" + ae + "\""); pw.println("}"); } catch (Exception e) { System.out.println(e); } }
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter writer = response.getWriter(); String fullname = request.getParameter("fullname"); String address = request.getParameter("address"); String city = request.getParameter("city"); String state = request.getParameter("state"); String zip = request.getParameter("zip"); writer.println("Full name: " + fullname); writer.println("Address: " + address); writer.println("City: " + city); writer.println("State: " + state); writer.println("Zip code: " + zip); writer.close(); }
public synchronized void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession dbSession = request.getSession(); JspFactory _jspxFactory = JspFactory.getDefaultFactory(); PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true); ServletContext dbApplication = dbSession.getServletContext(); ServletContext application; HttpSession session = request.getSession(); nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication); try { if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) { String finance_cheque_id = request.getParameter("finance_cheque_id"); String sql = "delete from finance_bill where id='" + finance_cheque_id + "'"; finance_db.executeUpdate(sql); finance_db.commit(); finance_db.close(); } else { response.sendRedirect("error_conn.htm"); } } catch (Exception ex) { ex.printStackTrace(); } }
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); Enumeration values = req.getParameterNames(); String name = ""; String value = ""; String id = ""; while (values.hasMoreElements()) { name = ((String) values.nextElement()).trim(); value = req.getParameter(name).trim(); if (name.equals("id")) id = value; } if (url.equals("")) { url = getServletContext().getInitParameter("url"); cas_url = getServletContext().getInitParameter("cas_url"); } HttpSession session = null; session = req.getSession(false); if (session != null) { session.invalidate(); } res.sendRedirect(cas_url); return; }