本文整理匯總了Java中org.apache.struts.action.ActionMapping.getInputForward方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionMapping.getInputForward方法的具體用法?Java ActionMapping.getInputForward怎麽用?Java ActionMapping.getInputForward使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.struts.action.ActionMapping
的用法示例。
在下文中一共展示了ActionMapping.getInputForward方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: previousQuestion
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
private ActionForward previousQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
AnswerForm answerForm = (AnswerForm) form;
Integer questionSeqID = answerForm.getQuestionSeqID();
String sessionMapID = answerForm.getSessionMapID();
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
.getAttribute(sessionMapID);
SortedMap<Integer, AnswerDTO> surveyItemMap = getQuestionList(sessionMap);
ActionErrors errors = getAnswer(request, surveyItemMap.get(questionSeqID));
if (!errors.isEmpty()) {
return mapping.getInputForward();
}
SortedMap<Integer, AnswerDTO> subMap = surveyItemMap.headMap(questionSeqID);
if (subMap.isEmpty()) {
questionSeqID = surveyItemMap.firstKey();
} else {
questionSeqID = subMap.lastKey();
}
// get current question index of total questions
int currIdx = new ArrayList<Integer>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1;
answerForm.setCurrentIdx(currIdx);
if (questionSeqID.equals(surveyItemMap.firstKey())) {
answerForm.setPosition(SurveyConstants.POSITION_FIRST);
} else {
answerForm.setPosition(SurveyConstants.POSITION_INSIDE);
}
answerForm.setQuestionSeqID(questionSeqID);
return mapping.findForward(SurveyConstants.SUCCESS);
}
示例2: newReflection
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Display empty reflection form.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get session value
String sessionMapID = WebUtil.readStrParam(request, ResourceConstants.ATTR_SESSION_MAP_ID);
if (!validateBeforeFinish(request, sessionMapID)) {
return mapping.getInputForward();
}
ReflectionForm refForm = (ReflectionForm) form;
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
refForm.setUserID(user.getUserID());
refForm.setSessionMapID(sessionMapID);
// get the existing reflection entry
IResourceService submitFilesService = getResourceService();
SessionMap<String, Object> map = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID);
NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
ResourceConstants.TOOL_SIGNATURE, user.getUserID());
if (entry != null) {
refForm.setEntryText(entry.getEntry());
}
return mapping.findForward(ResourceConstants.SUCCESS);
}
示例3: newReflection
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Display empty reflection form.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get session value
String sessionMapID = WebUtil.readStrParam(request, CommonCartridgeConstants.ATTR_SESSION_MAP_ID);
if (!validateBeforeFinish(request, sessionMapID)) {
return mapping.getInputForward();
}
ReflectionForm refForm = (ReflectionForm) form;
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
refForm.setUserID(user.getUserID());
refForm.setSessionMapID(sessionMapID);
// get the existing reflection entry
ICommonCartridgeService submitFilesService = getCommonCartridgeService();
SessionMap<String, Object> map = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID);
NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
CommonCartridgeConstants.TOOL_SIGNATURE, user.getUserID());
if (entry != null) {
refForm.setEntryText(entry.getEntry());
}
return mapping.findForward(CommonCartridgeConstants.SUCCESS);
}
示例4: finish
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Finish learning session.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
protected ActionForward finish(ActionMapping mapping, HttpServletRequest request) {
// get back SessionMap
String sessionMapID = request.getParameter(DacoConstants.ATTR_SESSION_MAP_ID);
SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
// get mode and ToolSessionID from sessionMAP
ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
ActionErrors errors = validateBeforeFinish(request, sessionMapID);
if (!errors.isEmpty()) {
this.addErrors(request, errors);
request.setAttribute(DacoConstants.ATTR_DISPLAYED_RECORD_NUMBER,
request.getParameter(DacoConstants.ATTR_DISPLAYED_RECORD_NUMBER));
return mapping.getInputForward();
}
IDacoService service = getDacoService();
// get sessionId from HttpServletRequest
String nextActivityUrl = null;
try {
HttpSession httpSession = SessionManager.getSession();
UserDTO user = (UserDTO) httpSession.getAttribute(AttributeNames.USER);
Long userUid = new Long(user.getUserID().longValue());
nextActivityUrl = service.finishToolSession(sessionId, userUid);
request.setAttribute(DacoConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
} catch (DacoApplicationException e) {
LearningAction.log.error("Failed get next activity url:" + e.getMessage());
}
return mapping.findForward(DacoConstants.SUCCESS);
}
示例5: startReflection
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Display empty reflection form.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
protected ActionForward startReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request) {
// get session value
String sessionMapID = WebUtil.readStrParam(request, DacoConstants.ATTR_SESSION_MAP_ID);
ActionErrors errors = validateBeforeFinish(request, sessionMapID);
if (!errors.isEmpty()) {
this.addErrors(request, errors);
refreshQuestionSummaries(mapping, request);
request.setAttribute(DacoConstants.ATTR_DISPLAYED_RECORD_NUMBER,
request.getParameter(DacoConstants.ATTR_DISPLAYED_RECORD_NUMBER));
return mapping.getInputForward();
}
SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
Long toolSessionID = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
IDacoService service = getDacoService();
ReflectionForm reflectionForm = (ReflectionForm) form;
HttpSession httpSession = SessionManager.getSession();
UserDTO userDTO = (UserDTO) httpSession.getAttribute(AttributeNames.USER);
DacoUser user = service.getUserByUserIdAndSessionId(userDTO.getUserID().longValue(), toolSessionID);
reflectionForm.setUserId(userDTO.getUserID());
reflectionForm.setSessionId(toolSessionID);
// get the existing reflection entry
NotebookEntry entry = service.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
DacoConstants.TOOL_SIGNATURE, userDTO.getUserID());
if (entry != null) {
reflectionForm.setEntryText(entry.getEntry());
}
request.setAttribute(DacoConstants.ATTR_SESSION_MAP_ID, sessionMapID);
reflectionForm.setSessionMapID(sessionMapID);
return mapping.findForward(DacoConstants.SUCCESS);
}
示例6: newReflection
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Display empty reflection form.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get session value
String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
if (!validateBeforeFinish(request, sessionMapID)) {
return mapping.getInputForward();
}
ReflectionForm refForm = (ReflectionForm) form;
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
refForm.setUserID(user.getUserID());
refForm.setSessionMapID(sessionMapID);
// get the existing reflection entry
IForumService submitFilesService = getForumManager();
SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID);
Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID);
NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
ForumConstants.TOOL_SIGNATURE, user.getUserID());
if (entry != null) {
refForm.setEntryText(entry.getEntry());
}
return mapping.findForward("success");
}
示例7: newReflection
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Display empty reflection form.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get session value
String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID);
if (!validateBeforeFinish(request, sessionMapID)) {
return mapping.getInputForward();
}
ReflectionForm refForm = (ReflectionForm) form;
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
refForm.setUserID(user.getUserID());
refForm.setSessionMapID(sessionMapID);
// get the existing reflection entry
ITaskListService submitFilesService = getTaskListService();
SessionMap<String, Object> map = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID);
NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
TaskListConstants.TOOL_SIGNATURE, user.getUserID());
if (entry != null) {
refForm.setEntryText(entry.getEntry());
}
return mapping.findForward(TaskListConstants.SUCCESS);
}
示例8: nextQuestion
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
private ActionForward nextQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
AnswerForm answerForm = (AnswerForm) form;
Integer questionSeqID = answerForm.getQuestionSeqID();
String sessionMapID = answerForm.getSessionMapID();
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
.getAttribute(sessionMapID);
SortedMap<Integer, AnswerDTO> surveyItemMap = getQuestionList(sessionMap);
ActionErrors errors = getAnswer(request, surveyItemMap.get(questionSeqID));
if (!errors.isEmpty()) {
return mapping.getInputForward();
}
// go to next question
boolean next = false;
for (Map.Entry<Integer, AnswerDTO> entry : surveyItemMap.entrySet()) {
if (entry.getKey().equals(questionSeqID)) {
next = true;
// failure tolerance: if arrive last one
questionSeqID = entry.getKey();
continue;
}
if (next) {
questionSeqID = entry.getKey();
break;
}
}
// get current question index of total questions
int currIdx = new ArrayList<Integer>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1;
answerForm.setCurrentIdx(currIdx);
// failure tolerance
if (questionSeqID.equals(surveyItemMap.lastKey())) {
answerForm.setPosition(SurveyConstants.POSITION_LAST);
} else {
answerForm.setPosition(SurveyConstants.POSITION_INSIDE);
}
answerForm.setQuestionSeqID(questionSeqID);
return mapping.findForward(SurveyConstants.SUCCESS);
}
示例9: doSurvey
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
private ActionForward doSurvey(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
ISurveyService service = getSurveyService();
AnswerForm answerForm = (AnswerForm) form;
Integer questionSeqID = answerForm.getQuestionSeqID();
String sessionMapID = answerForm.getSessionMapID();
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
.getAttribute(sessionMapID);
// validate
SortedMap<Integer, AnswerDTO> surveyItemMap = getQuestionList(sessionMap);
Collection<AnswerDTO> surveyItemList = surveyItemMap.values();
SurveyUser surveyLearner = (SurveyUser) sessionMap.get(SurveyConstants.ATTR_USER);
Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
ActionErrors errors;
if ((questionSeqID == null) || questionSeqID.equals(0)) {
errors = getAnswers(request);
} else {
errors = getAnswer(request, surveyItemMap.get(questionSeqID));
}
if (!errors.isEmpty()) {
return mapping.getInputForward();
}
List<SurveyAnswer> answerList = new ArrayList<SurveyAnswer>();
for (AnswerDTO question : surveyItemList) {
if (question.getAnswer() != null) {
question.getAnswer().setUser(surveyLearner);
answerList.add(question.getAnswer());
}
}
service.updateAnswerList(answerList);
request.setAttribute(SurveyConstants.ATTR_SESSION_MAP_ID, sessionMapID);
Survey survey = service.getSurveyBySessionId(sessionId);
if (survey.isNotifyTeachersOnAnswerSumbit()) {
service.notifyTeachersOnAnswerSumbit(sessionId, surveyLearner);
}
return mapping.findForward(SurveyConstants.SUCCESS);
}
示例10: finish
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Finish learning session.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get back SessionMap
String sessionMapID = request.getParameter(ResourceConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
// get mode and ToolSessionID from sessionMAP
ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
// auto run mode, when use finish the only one resource item, mark it as complete then finish this activity as
// well.
String resourceItemUid = request.getParameter(ResourceConstants.PARAM_RESOURCE_ITEM_UID);
if (resourceItemUid != null) {
doComplete(request);
// NOTE:So far this flag is useless(31/08/2006).
// set flag, then finish page can know redir target is parent(AUTO_RUN) or self(normal)
request.setAttribute(ResourceConstants.ATTR_RUN_AUTO, true);
} else {
request.setAttribute(ResourceConstants.ATTR_RUN_AUTO, false);
}
if (!validateBeforeFinish(request, sessionMapID)) {
return mapping.getInputForward();
}
IResourceService service = getResourceService();
// get sessionId from HttpServletRequest
String nextActivityUrl = null;
try {
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
Long userID = new Long(user.getUserID().longValue());
nextActivityUrl = service.finishToolSession(sessionId, userID);
request.setAttribute(ResourceConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
} catch (ResourceApplicationException e) {
LearningAction.log.error("Failed get next activity url:" + e.getMessage());
}
return mapping.findForward(ResourceConstants.SUCCESS);
}
示例11: finish
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Finish learning session.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get back SessionMap
String sessionMapID = request.getParameter(CommonCartridgeConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
// get mode and ToolSessionID from sessionMAP
ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
// auto run mode, when use finish the only one commonCartridge item, mark it as complete then finish this activity as
// well.
String commonCartridgeItemUid = request.getParameter(CommonCartridgeConstants.PARAM_RESOURCE_ITEM_UID);
if (commonCartridgeItemUid != null) {
doComplete(request);
// NOTE:So far this flag is useless(31/08/2006).
// set flag, then finish page can know redir target is parent(AUTO_RUN) or self(normal)
request.setAttribute(CommonCartridgeConstants.ATTR_RUN_AUTO, true);
} else {
request.setAttribute(CommonCartridgeConstants.ATTR_RUN_AUTO, false);
}
if (!validateBeforeFinish(request, sessionMapID)) {
return mapping.getInputForward();
}
ICommonCartridgeService service = getCommonCartridgeService();
// get sessionId from HttpServletRequest
String nextActivityUrl = null;
try {
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
Long userID = new Long(user.getUserID().longValue());
nextActivityUrl = service.finishToolSession(sessionId, userID);
request.setAttribute(CommonCartridgeConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
} catch (CommonCartridgeApplicationException e) {
LearningAction.log.error("Failed get next activity url:" + e.getMessage());
}
return mapping.findForward(CommonCartridgeConstants.SUCCESS);
}
示例12: updateContent
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Update all content for submit tool except online/offline instruction files list.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws NoSuchMethodException
* @throws InvocationTargetException
* @throws Exception
*/
public ActionForward updateContent(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
AuthoringForm authForm = (AuthoringForm) form;
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(authForm.getSessionMapID());
ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.PARAM_MODE);
ActionMessages errors = validate(authForm, mapping, request);
if (!errors.isEmpty()) {
saveErrors(request, errors);
return mapping.getInputForward();
}
SubmitFilesContent content = getContent(form);
submitFilesService = getService();
SubmitFilesContent persistContent = submitFilesService.getSubmitFilesContent(content.getContentID());
if (persistContent == null) {
// new content
persistContent = content;
content.setCreated(new Date());
} else {
Long uid = persistContent.getContentID();
PropertyUtils.copyProperties(persistContent, content);
persistContent.setContentID(uid);
// if it is Teacher (from monitor) - change define later status
if (mode.isTeacher()) {
persistContent.setDefineLater(false);
}
}
// *******************************Handle user*******************
// get session from shared session.
HttpSession ss = SessionManager.getSession();
// get back login user DTO
UserDTO userDto = (UserDTO) ss.getAttribute(AttributeNames.USER);
Long contentId = authForm.getToolContentID();
SubmitUser user = submitFilesService.getContentUser(contentId, userDto.getUserID());
if (user == null) {
user = submitFilesService.createContentUser(userDto, contentId);
}
persistContent.setCreatedBy(user);
submitFilesService.saveOrUpdateContent(persistContent);
// to jump to common success page in lams_central
request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE);
return mapping.findForward("success");
}
示例13: finish
import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
* Finish learning session.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get back SessionMap
String sessionMapID = request.getParameter(TaskListConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
// auto run mode, when use finish the only one taskList item, mark it as complete then finish this activity as
// well.
String taskListItemUid = request.getParameter(TaskListConstants.PARAM_ITEM_UID);
if (taskListItemUid != null) {
doComplete(request);
// NOTE:So far this flag is useless(31/08/2006).
// set flag, then finish page can know redir target is parent(AUTO_RUN) or self(normal)
request.setAttribute(TaskListConstants.ATTR_RUN_AUTO, true);
} else {
request.setAttribute(TaskListConstants.ATTR_RUN_AUTO, false);
}
if (!validateBeforeFinish(request, sessionMapID)) {
return mapping.getInputForward();
}
ITaskListService service = getTaskListService();
// get sessionId from HttpServletRequest
String nextActivityUrl = null;
try {
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
Long userID = new Long(user.getUserID().longValue());
nextActivityUrl = service.finishToolSession(sessionId, userID);
request.setAttribute(TaskListConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
} catch (TaskListException e) {
log.error("Failed get next activity url:" + e.getMessage());
}
return mapping.findForward(TaskListConstants.SUCCESS);
}