questionform.java
来自「老外的在线考试」· Java 代码 · 共 95 行
JAVA
95 行
/* * CyberTester - J2EE Web application for creating, delivering and managing tests/exams/surveys. * Copyright (C) 2003 CyberDemia Research and Services Pty Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, write to the * Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * See the COPYING file located in the top-level-directory of * the archive of this program for complete text of license. */package com.cyberdemia.cybertester.student.test;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.*;/** * * QuestionForm is a Struts ActionForm to send, receive and validate values from * the single question form. * * @author Alexander Yap */public final class QuestionForm extends ActionForm{ public int getAnswer() { return m_answer; } public void setAnswer(int ans) { m_answer = ans; } public Object getQuesId() { return m_id; } public void setQuesId(Object id) { m_id = id; } public int getQuesIndex() { return m_index; }/* public int getQuesDisplayNumber() { return m_index+1; }*/ public void setQuesIndex(int index) { m_index = index; } /** * Reset all properties to their default values. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { m_answer = 0; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((m_answer<0) || (m_answer>=4)) errors.add("answer", new ActionError("error.answer.required")); return errors; } private int m_answer = 0; private Object m_id = null; private int m_index = 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?