📄 finishaction.java
字号:
package org.yeeku.action;
import org.apache.struts.action.*;
import org.apache.struts.validator.DynaValidatorForm;
import javax.servlet.http.*;
import java.util.*;
import org.yeeku.action.base.BaseAction;
import org.yeeku.model.Question;
/**
* @author yeeku.H.lee kongyeeku@163.com
* @version 1.0
* <br>Copyright (C), 2005-2008, yeeku.H.Lee
* <br>This program is protected by copyright laws.
* <br>Program Name:
* <br>Date:
*/
public class FinishAction extends BaseAction
{
public ActionForward execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception
{
HttpSession session = request.getSession(false);
Map<String , Integer> replyMap = null;
if( (replyMap = (Map)session.getAttribute("replyMap")) == null )
{
replyMap = new HashMap<String , Integer>();
}
int questionTotal = 0;
int rightTotal = 0;
int total = 0;
for (String replyId : replyMap.keySet())
{
int score = replyMap.get(replyId);
total += score;
if (score > 0)
{
rightTotal++;
}
questionTotal++;
}
request.setAttribute("total" , total);
request.setAttribute("questionTotal" , questionTotal);
request.setAttribute("rightTotal" , rightTotal);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -