本文整理汇总了Java中org.apache.struts.action.ActionForward类的典型用法代码示例。如果您正苦于以下问题:Java ActionForward类的具体用法?Java ActionForward怎么用?Java ActionForward使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionForward类属于org.apache.struts.action包,在下文中一共展示了ActionForward类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: editItemInit
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* Display edit page for existed resource item.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward editItemInit(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, ResourceConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
int itemIdx = NumberUtils.stringToInt(request.getParameter(ResourceConstants.PARAM_ITEM_INDEX), -1);
ResourceItem item = null;
if (itemIdx != -1) {
SortedSet<ResourceItem> resourceList = getResourceItemList(sessionMap);
List<ResourceItem> rList = new ArrayList<ResourceItem>(resourceList);
item = rList.get(itemIdx);
if (item != null) {
populateItemToForm(itemIdx, item, (ResourceItemForm) form, request);
}
}
return findForward(item == null ? -1 : item.getType(), mapping);
}
示例2: handleCancelRequest
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* NOT YET DOCUMENTED
*
*@param mapping the ActionMapping
*@param form the ActionForm
*@param request the Request
*@param response the Response
*@return NOT YET DOCUMENTED
*@exception ServletException NOT YET DOCUMENTED
*/
protected ActionForward handleCancelRequest(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException {
SchemEditForm sef = (SchemEditForm) form;
String recId = sef.getRecId();
sef.setRecId("");
if (sef.getCollection() != null && sef.getCollection().trim().length() > 0) {
// prtln("about to forward to admin, with collection=" + sef.getCollection());
return SchemEditUtils.forwardToCaller(request, recId, getSessionBean (request));
} else {
throw new ServletException("handleCancelRequest was not supplied a collection");
}
}
示例3: execute
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
if (isCancelled(request)) {
return mapping.findForward("sysadmin");
}
IImportService importService = AdminServiceProxy.getImportService(getServlet().getServletContext());
ImportExcelForm importForm = (ImportExcelForm) form;
importForm.setOrgId(0);
FormFile file = importForm.getFile();
// validation
if (file == null || file.getFileSize() <= 0) {
return mapping.findForward("importGroups");
}
List results = importService.parseGroupSpreadsheet(file);
request.setAttribute("results", results);
return mapping.findForward("importGroups");
}
示例4: execute
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* Original Struts Action's method.
* Retrieve current Tile context and call TilesAction execute method.
* Do not overload this method!
*
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request (if any).
* @param request The HTTP request we are processing.
* @param response The HTTP response we are creating.
*
* @exception Exception if the application business logic throws
* an exception
* @since Struts 1.1
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Try to retrieve tile context
ComponentContext context = ComponentContext.getContext(request);
if (context == null) {
throw new ServletException(
"Can't find Tile context for '"
+ this.getClass().getName()
+ "'. TilesAction subclasses must be called from a Tile");
}
return this.execute(context, mapping, form, request, response);
}
示例5: execute
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String param = mapping.getParameter();
if (param.equals("newConditionInit")) {
return newConditionInit(mapping, form, request, response);
}
if (param.equals("editCondition")) {
return editCondition(mapping, form, request, response);
}
if (param.equals("saveOrUpdateCondition")) {
return saveOrUpdateCondition(mapping, form, request, response);
}
if (param.equals("removeCondition")) {
return removeCondition(mapping, form, request, response);
}
if (param.equals("upCondition")) {
return upCondition(mapping, form, request, response);
}
if (param.equals("downCondition")) {
return downCondition(mapping, form, request, response);
}
return null;
}
示例6: finishActivity
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
public ActionForward finishActivity(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
initKalturaService();
// get back SessionMap
String sessionMapID = request.getParameter(KalturaConstants.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);
// get sessionId from HttpServletRequest
String nextActivityUrl = null;
try {
HttpSession ss = SessionManager.getSession();
UserDTO userDTO = (UserDTO) ss.getAttribute(AttributeNames.USER);
Long userID = new Long(userDTO.getUserID().longValue());
nextActivityUrl = service.finishToolSession(sessionId, userID);
request.setAttribute(KalturaConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
} catch (KalturaException e) {
LearningAction.log.error("Failed get next activity url:" + e.getMessage());
}
return mapping.findForward(KalturaConstants.FINISH);
}
示例7: statistic
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
private ActionForward statistic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
initializeScratchieService();
String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
.getAttribute(sessionMapID);
request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
Scratchie scratchie = (Scratchie) sessionMap.get(ScratchieConstants.ATTR_SCRATCHIE);
if ( scratchie != null ) {
LeaderResultsDTO leaderDto = service.getLeaderResultsDTOForLeaders(scratchie.getContentId());
sessionMap.put("leaderDto", leaderDto);
}
return mapping.findForward(ScratchieConstants.SUCCESS);
}
示例8: handleCancelCommand
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* NOT YET DOCUMENTED
*
* @param mapping NOT YET DOCUMENTED
* @param form NOT YET DOCUMENTED
* @param request NOT YET DOCUMENTED
* @param response NOT YET DOCUMENTED
* @return NOT YET DOCUMENTED
*/
protected ActionForward handleCancelCommand(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
SuggestCommentForm scf = (SuggestCommentForm) form;
ActionErrors errors = new ActionErrors();
scf.clear();
scf.setItemID("");
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("comment.cancel"));
saveMessages(request, errors);
return mapping.findForward("home");
}
示例9: unspecified
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
*
* main content/question content management and workflow logic
*
* if the passed toolContentID exists in the db, we need to get the relevant data into the Map if not, create the
* default Map
*/
@Override
public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
VoteUtils.cleanUpUserExceptions(request);
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO();
repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO);
String richTextTitle = request.getParameter(TITLE);
String richTextInstructions = request.getParameter(INSTRUCTIONS);
if (richTextTitle != null) {
voteGeneralAuthoringDTO.setActivityTitle(richTextTitle);
}
if (richTextInstructions != null) {
voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
}
voteAuthoringForm.resetUserAction();
return null;
}
示例10: updateTopic
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* Update a topic.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws PersistenceException
*/
public ActionForward updateTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws PersistenceException {
forumService = getForumManager();
MessageForm messageForm = (MessageForm) form;
SessionMap sessionMap = getSessionMap(request, messageForm);
Long topicId = (Long) sessionMap.get(ForumConstants.ATTR_TOPIC_ID);
Message message = messageForm.getMessage();
doUpdateTopic(request, messageForm, sessionMap, topicId, message);
// echo back this topic thread into page
Long rootTopicId = forumService.getRootTopicId(topicId);
ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID));
Forum forum = forumUser.getSession().getForum();
setupViewTopicPagedDTOList(request, rootTopicId, messageForm.getSessionMapID(), forumUser, forum, null, null);
return mapping.findForward("success");
}
示例11: validateParameters
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* validates request paramaters based on tool contract
*
* @param request
* @param mapping
* @return ActionForward
* @throws ServletException
*/
protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping,
QaMonitoringForm qaMonitoringForm) throws ServletException {
String strToolContentId = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
if ((strToolContentId == null) || (strToolContentId.length() == 0)) {
QaUtils.cleanUpSessionAbsolute(request);
throw new ServletException("No Tool Content ID found");
} else {
try {
long toolContentId = new Long(strToolContentId).longValue();
qaMonitoringForm.setToolContentID(new Long(toolContentId).toString());
} catch (NumberFormatException e) {
QaUtils.cleanUpSessionAbsolute(request);
throw e;
}
}
return null;
}
示例12: removeMarkFile
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* Remove a mark file
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
public ActionForward removeMarkFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
MarkForm markForm = (MarkForm) form;
if (submitFilesService == null) {
submitFilesService = getSubmitFilesService();
}
submitFilesService.removeMarkFile(markForm.getReportID(), markForm.getMarkFileUUID(),
markForm.getMarkFileVersionID());
FileDetailsDTO fileDetailsDTO = submitFilesService.getFileDetails(markForm.getDetailID(), request.getLocale());
updateMarkForm(markForm, fileDetailsDTO);
List report = new ArrayList<FileDetailsDTO>();
report.add(submitFilesService.getFileDetails(markForm.getDetailID(), request.getLocale()));
request.setAttribute("updateMode", markForm.getUpdateMode());
request.setAttribute("toolSessionID", markForm.getToolSessionID());
request.setAttribute("report", report);
return mapping.findForward("updateMark");
}
示例13: checkGroupingNameUnique
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* Checks if a course grouping name is unique inside of this organisation and thus whether the new group can be named using it
*/
public ActionForward checkGroupingNameUnique(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws JSONException, IOException {
IUserManagementService userManagementService = MonitoringServiceProxy.getUserManagementService(getServlet().getServletContext());
Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID);
String newGroupingName = request.getParameter("name");
// Checks if a course grouping name is unique inside of this group and thus new group can have it
HashMap<String, Object> properties = new HashMap<String, Object>();
properties.put("organisationId", organisationId);
properties.put("name", newGroupingName);
List<OrganisationGrouping> orgGroupings = userManagementService.findByProperties(OrganisationGrouping.class,
properties);
boolean isGroupingNameUnique = orgGroupings.isEmpty();
JSONObject responseJSON = new JSONObject();
responseJSON.put("isGroupingNameUnique", isGroupingNameUnique);
response.setContentType("application/json;charset=utf-8");
response.getWriter().write(responseJSON.toString());
return null;
}
示例14: setSubmissionDeadline
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* Set Submission Deadline
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws IOException
*/
public ActionForward setSubmissionDeadline(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IOException {
setupService();
Long contentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
Mindmap mindmap = mindmapService.getMindmapByContentId(contentID);
Long dateParameter = WebUtil.readLongParam(request, MindmapConstants.ATTR_SUBMISSION_DEADLINE, true);
Date tzSubmissionDeadline = null;
String formattedDate = "";
if (dateParameter != null) {
Date submissionDeadline = new Date(dateParameter);
HttpSession ss = SessionManager.getSession();
UserDTO teacher = (UserDTO) ss.getAttribute(AttributeNames.USER);
TimeZone teacherTimeZone = teacher.getTimeZone();
tzSubmissionDeadline = DateUtil.convertFromTimeZoneToDefault(teacherTimeZone, submissionDeadline);
formattedDate = DateUtil.convertToStringForJSON(tzSubmissionDeadline, request.getLocale());
}
mindmap.setSubmissionDeadline(tzSubmissionDeadline);
mindmapService.saveOrUpdateMindmap(mindmap);
response.setContentType("text/plain;charset=utf-8");
response.getWriter().print(formattedDate);
return null;
}
示例15: newOverallFeedback
import org.apache.struts.action.ActionForward; //导入依赖的package包/类
/**
* Ajax call, will add one more input line for new OverallFeedback.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
*/
private ActionForward newOverallFeedback(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
TreeSet<AssessmentOverallFeedback> overallFeedbackList = getOverallFeedbacksFromRequest(request, false);
AssessmentOverallFeedback overallFeedback = new AssessmentOverallFeedback();
int maxSeq = 1;
if ((overallFeedbackList != null) && (overallFeedbackList.size() > 0)) {
AssessmentOverallFeedback last = overallFeedbackList.last();
maxSeq = last.getSequenceId() + 1;
}
overallFeedback.setSequenceId(maxSeq);
overallFeedbackList.add(overallFeedback);
request.setAttribute(AssessmentConstants.ATTR_OVERALL_FEEDBACK_LIST, overallFeedbackList);
return mapping.findForward(AssessmentConstants.SUCCESS);
}