⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 verifysubmissionservlet.java.svn-base

📁 远程学生作业提交系统,所用技术JSP,Servelet,Ajax,Web Services,MySql
💻 SVN-BASE
字号:
/*
 * VerifySubmissionServlet.java
 *
 * Created on October 19, 2006, 1:07 AM
 */

package com.sixtwenty.servlet;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import com.sixtwenty.*;

/**
 * This servlet is used to verify the submission made
 * @author grp-e
 */
public class VerifySubmissionServlet extends HttpServlet {

	//String endpoint = "http://172.23.96.22:8180/axis/services/submit";
	String endpoint = "http://localhost:8080/axis/services/submit";

	/**
	 * Handles the get request
	 * @param request
	 * @param response
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
	throws IOException, ServletException
	{
		doPost(request, response);
	}

	/**
	 * Handles the post request
	 * @param request
	 * @param response
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
	throws IOException, ServletException {
		response.setContentType("text/html");
		PrintWriter out = response.getWriter ();

		try {
			String submissionId = (String)request.getParameter("subId");	//The submissionId

			// To call the remote service
			Submit submit = null;
			try {

				//Instantiate the SubmitServiceLocator
				SubmitServiceLocator ssl = new SubmitServiceLocator();
				submit = ssl.getsubmit();
			} catch(Exception e) {
				throw new ServletException(e.toString());
			}

			// To get the staff identifier
			String username = (String)request.getSession().getAttribute("username");

			// If we don't know the username's identifier => access error
			if (username == null || username.equals("")) {

				//Access error, forwarding to error page
				RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/jsp/errorpage.jsp");
				requestDispatcher.forward(request, response);
				return;
			}

			// If the verification is ok we get all the informations from this submission
			if (submit.verifySubmission(submissionId).equals("true")) {

				//call to remote method getSubmission
				Submissions submissions = submit.getSubmission(submissionId);

				//set the list of submissions in list
				request.getSession().setAttribute("submissions", submissions);
			}

			//Forwarding to next jsp
			RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/jsp/verifyassignment.jsp");
			requestDispatcher.forward(request, response);
			return;
		} catch (Exception e) {
			out.println(e.toString());
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -