当前位置: 首页>>代码示例>>Java>>正文


Java ActionMapping类代码示例

本文整理汇总了Java中org.apache.struts.action.ActionMapping的典型用法代码示例。如果您正苦于以下问题:Java ActionMapping类的具体用法?Java ActionMapping怎么用?Java ActionMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ActionMapping类属于org.apache.struts.action包,在下文中一共展示了ActionMapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportExcel

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
/**
    * Exports tool results into excel.
    * 
    * @throws IOException
    */
   private ActionForward exportExcel(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException {

initializeScratchieService();
String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
Scratchie scratchie = (Scratchie) sessionMap.get(ScratchieConstants.ATTR_SCRATCHIE);

LinkedHashMap<String, ExcelCell[][]> dataToExport = service.exportExcel(scratchie.getContentId());

String fileName = "scratchie_export.xlsx";
fileName = FileUtil.encodeFilenameForDownload(request, fileName);

response.setContentType("application/x-download");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);

// set cookie that will tell JS script that export has been finished
String downloadTokenValue = WebUtil.readStrParam(request, "downloadTokenValue");
Cookie fileDownloadTokenCookie = new Cookie("fileDownloadToken", downloadTokenValue);
fileDownloadTokenCookie.setPath("/");
response.addCookie(fileDownloadTokenCookie);

// Code to generate file and write file contents to response
ServletOutputStream out = response.getOutputStream();
ExcelUtil.createExcel(out, dataToExport, null, false);

return null;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:MonitoringAction.java

示例2: deleteLearnerFile

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
public ActionForward deleteLearnerFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IOException {
HttpSession ss = SessionManager.getSession();


UserDTO currentUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER);
Long detailID = WebUtil.readLongParam(request, "detailId");

if (submitFilesService == null) {
    submitFilesService = getSubmitFilesService();
}
FileDetailsDTO fileDetail = submitFilesService.getFileDetails(detailID, request.getLocale());

if (fileDetail.getOwner().getUserID().equals(currentUser.getUserID()) && (StringUtils.isBlank(fileDetail.getMarks()))) {

    submitFilesService.removeLearnerFile(detailID,null);

} else {
  response.sendError(HttpServletResponse.SC_FORBIDDEN, "You are not allowed to delete this item");
}
return null;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:LearnerAction.java

示例3: unspecified

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
@Override
   public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
// set up mdlForumService
if (dokumaranService == null) {
    dokumaranService = DokumaranServiceProxy.getDokumaranService(this.getServlet().getServletContext());
}

AdminForm adminForm = (AdminForm) form;

DokumaranConfigItem etherpadUrl = dokumaranService.getConfigItem(DokumaranConfigItem.KEY_ETHERPAD_URL);
if (etherpadUrl != null) {
    adminForm.setEtherpadUrl(etherpadUrl.getConfigValue());
}

DokumaranConfigItem apiKey = dokumaranService.getConfigItem(DokumaranConfigItem.KEY_API_KEY);
if (apiKey != null) {
    adminForm.setApiKey(apiKey.getConfigValue());
}

request.setAttribute("error", false);
return mapping.findForward("config");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:AdminAction.java

示例4: addLessonDependency

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
/**
    * Adds given lesson to dependecies and displays updated list in thickbox.
    *
    * @throws IOException
    *
    * @throws InvalidParameterException
    */
   public ActionForward addLessonDependency(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException {
Long lessonId = WebUtil.readLongParam(request, CentralConstants.PARAM_LESSON_ID, false);
if (!getSecurityService().isLessonOwner(lessonId, getUser().getUserID(), "add lesson dependency", false)) {
    response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not the owner of the lesson");
    return null;
}

Long addedPrecedingLessonId = WebUtil.readLongParam(request, LessonConditionsAction.PARAM_PRECEDING_LESSON_ID,
	false);
Lesson lesson = getLessonService().getLesson(lessonId);
Lesson addedPrecedingLesson = getLessonService().getLesson(addedPrecedingLessonId);
if (addedPrecedingLesson == null) {
    throw new IllegalArgumentException("Preceding lesson with ID: " + lessonId + " does not exist.");
}

lesson.getPrecedingLessons().add(addedPrecedingLesson);

// after operation, display contents again
return getIndexLessonConditions(mapping, form, request, response);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:LessonConditionsAction.java

示例5: execute

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
public ActionForward execute (
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
	throws IOException, ServletException {

	SchemEditForm sef = (SchemEditForm) form;
	ActionErrors errors = initializeFromContext (mapping, request);
	if (!errors.isEmpty()) {
		saveErrors (request, errors);
		return (mapping.findForward("error.page"));
	}
	
	String errorMsg;
	recordsDir = getRecordsDir();
	if (recordsDir == null) {
		errorMsg = "attribute \"recordsDir\" not found";
		prtln(errorMsg);
		throw new ServletException(errorMsg);
	}
	sef.setRecordsDir(recordsDir);
	
	return super.execute (mapping, form, request, response);
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:26,代码来源:StandAloneSchemEditAction.java

示例6: handleDeleteElement

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
/**
* Wrap handleDeleteElement so we can update suggestion service helper in the case
* that the standards field has been deleted.
*/
protected ActionForward handleDeleteElement(ActionMapping mapping,
                                            ActionForm form,
                                            HttpServletRequest request,
                                            SchemEditValidator validator)
	 throws ServletException {
	prtln ("handleDeleteElement()");
	SchemEditForm sef = (SchemEditForm) form;
	ActionErrors errors = new ActionErrors();
	ActionForward forward = super.handleDeleteElement(mapping, form, request, validator);
	if (sef.getSuggestionServiceHelper() != null) {
		try {
			this.initSuggestionServiceHelper(sef);
		} catch (Exception e) {
			prtlnErr ("suggestionServiceHelper error: " + e.getMessage());
		}
	}
	return forward;
 }
 
开发者ID:NCAR,项目名称:joai-project,代码行数:23,代码来源:DCSSchemEditAction.java

示例7: initPage

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
/**
    * Display same entire authoring page content from HttpSession variable.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws ServletException
    */
   private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
String sessionMapID = WebUtil.readStrParam(request, PeerreviewConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
PeerreviewForm existForm = (PeerreviewForm) sessionMap.get(PeerreviewConstants.ATTR_PEERREVIEW_FORM);

PeerreviewForm peerreviewForm = (PeerreviewForm) form;
try {
    PropertyUtils.copyProperties(peerreviewForm, existForm);
} catch (Exception e) {
    throw new ServletException(e);
}

ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request);
request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());

return mapping.findForward(PeerreviewConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:AuthoringAction.java

示例8: validate

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
/**
 * Validate the properties that have been set from this HTTP request,
 * and return an <code>ActionErrors</code> object that encapsulates any
 * validation errors that have been found.  If no errors are found, return
 * <code>null</code> or an <code>ActionErrors</code> object with no
 * recorded error messages.
 *
 * @param mapping The mapping used to select this instance
 * @param request The servlet request we are processing
 * @return  <code>ActionErrors</code> object that encapsulates any  validation errors

 */
public ActionErrors validate(ActionMapping mapping,
                             HttpServletRequest request) {

    ServletContext application = getServlet().getServletContext();
    ActionErrors errors = new ActionErrors();

    String validationKey = getValidationKey(mapping, request);

    Validator validator = Resources.initValidator(validationKey,
                         this,
                         application, request,
                         errors, page);

    try {
        validatorResults = validator.validate();
    } catch (ValidatorException e) {
        log.error(e.getMessage(), e);
    }

    return errors;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:ValidatorForm.java

示例9: handleEditCommand

import org.apache.struts.action.ActionMapping; //导入依赖的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 handleEditCommand(
                                          ActionMapping mapping,
                                          ActionForm form,
                                          HttpServletRequest request,
                                          HttpServletResponse response)
										  throws Exception {

											  
	SuggestCommentForm scf = (SuggestCommentForm) form;
	
	if (scf.getItemID() == null || scf.getItemID().length() == 0 ) {			
		prtln("can't edit without a id ... bailing");
		return handleStaleData(mapping, form, request);
	}
	
	
	return mapping.findForward("form");
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:28,代码来源:SuggestCommentAction.java

示例10: handleCancelCommand

import org.apache.struts.action.ActionMapping; //导入依赖的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");
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:27,代码来源:SuggestCommentAction.java

示例11: doFinish

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
private ActionForward doFinish(ActionMapping mapping, HttpServletRequest request, Long sessionId) {
IPeerreviewService service = getPeerreviewService();
// 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(PeerreviewConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
} catch (PeerreviewApplicationException e) {
    LearningAction.log.error("Failed get next activity url:" + e.getMessage());
}

return mapping.findForward("finish");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:LearningAction.java

示例12: findForward

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
/**
    * Get back relative <code>ActionForward</code> from request.
    *
    * @param type
    * @param mapping
    * @return
    */
   private ActionForward findForward(short type, ActionMapping mapping) {
ActionForward forward;
switch (type) {
    case CommonCartridgeConstants.RESOURCE_TYPE_BASIC_LTI:
	forward = mapping.findForward("basiclti");
	break;
    case CommonCartridgeConstants.RESOURCE_TYPE_COMMON_CARTRIDGE:
	forward = mapping.findForward("commoncartridge");
	break;
    default:
	forward = null;
	break;
}
return forward;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:AuthoringAction.java

示例13: unspecified

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
@Override
   public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
// set up mdlForumService
if (pixlrService == null) {
    pixlrService = PixlrServiceProxy.getPixlrService(this.getServlet().getServletContext());
}

AdminForm adminForm = (AdminForm) form;

PixlrConfigItem pixlrKey = pixlrService.getConfigItem(PixlrConfigItem.KEY_LANGUAGE_CSV);
if (pixlrKey != null) {
    adminForm.setLanguagesCSV(pixlrKey.getConfigValue());
}

request.setAttribute("error", false);
return mapping.findForward("config");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AdminAction.java

示例14: execute

import org.apache.struts.action.ActionMapping; //导入依赖的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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:TilesAction.java

示例15: autoSaveAnswers

import org.apache.struts.action.ActionMapping; //导入依赖的package包/类
/**
    * auto saves responses
    * @throws NoSuchMethodException 
    * @throws InvocationTargetException 
    * @throws IllegalAccessException 
    */
   private ActionForward autoSaveAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
IAssessmentService service = getAssessmentService();
String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
int pageNumber = (Integer) sessionMap.get(AssessmentConstants.ATTR_PAGE_NUMBER);

//get user answers from request and store them into sessionMap
storeUserAnswersIntoSessionMap(request, pageNumber);
//store results from sessionMap into DB
storeUserAnswersIntoDatabase(sessionMap, true);

return null;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:LearningAction.java


注:本文中的org.apache.struts.action.ActionMapping类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。