listofsubmissionsservlet.java.svn-base

来自「远程学生作业提交系统,所用技术JSP,Servelet,Ajax,Web Ser」· SVN-BASE 代码 · 共 86 行

SVN-BASE
86
字号
/*
 * ListOfSubmissionsServlet.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 list the submissions
 * @author grp-e
 *
 */
public class ListOfSubmissionsServlet extends HttpServlet {

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

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


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

		try {

			// The list of submissions done by this user
			Submissions[] submissions = null;

			String username = (String)request.getSession().getAttribute("username");	//The username

			// preparation of the object 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());
			}

			//call to remote method getSubmissionList
			submissions = submit.getSubmissionList(username);

			//set the list od submissions in session
			request.getSession().setAttribute("submissions", submissions);

			//Forwarding to next jsp
			RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsp/listofsubmissions.jsp");
			dispatcher.forward(request, response);

		} catch (Exception e) {
			out.println(e.toString());
		}
	}
}

⌨️ 快捷键说明

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