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


Java ActionForm类代码示例

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


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

示例1: toggleFavoriteOrganisation

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Toggles whether organisation is marked as favorite.
    */
   public ActionForward toggleFavoriteOrganisation(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse res) throws IOException, ServletException {
getUserManagementService();
Integer orgId = WebUtil.readIntParam(request, "orgId", false);
Integer userId = getUserId();

if (orgId != null) {
    userManagementService.toggleOrganisationFavorite(orgId, userId);
}

List<Organisation> favoriteOrganisations = userManagementService.getFavoriteOrganisationsByUser(userId);
request.setAttribute("favoriteOrganisations", favoriteOrganisations);

String activeOrgId = request.getParameter("activeOrgId");
request.setAttribute("activeOrgId", activeOrgId);

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

示例2: editCondition

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Display edit page for existed taskList item.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward editCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

NotebookConditionForm notebookConditionForm = (NotebookConditionForm) form;
String sessionMapID = notebookConditionForm.getSessionMapID();
SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);

int orderId = NumberUtils.stringToInt(request.getParameter(NotebookConstants.PARAM_ORDER_ID), -1);
NotebookCondition condition = null;
if (orderId != -1) {
    SortedSet<NotebookCondition> conditionSet = getNotebookConditionSet(sessionMap);
    List<NotebookCondition> conditionList = new ArrayList<NotebookCondition>(conditionSet);
    condition = conditionList.get(orderId);
    if (condition != null) {
	populateConditionToForm(orderId, condition, (NotebookConditionForm) form, request);
    }
}
return condition == null ? null : mapping.findForward("addcondition");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:AuthoringNotebookConditionAction.java

示例3: updateTopicInline

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Update a topic.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws PersistenceException
    * @throws JSONException
    * @throws IOException
    */
   public ActionForward updateTopicInline(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws PersistenceException, JSONException, IOException {

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);

JSONObject JSONObject = new JSONObject();
JSONObject.put(ForumConstants.ATTR_MESS_ID, topicId);
JSONObject.put(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID());
Long rootTopicId = forumService.getRootTopicId(topicId);
JSONObject.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId);
response.setContentType("application/json;charset=utf-8");
response.getWriter().print(JSONObject);
return null;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:LearningAction.java

示例4: openGateForSingleUser

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Allows a single learner to pass the gate.
    *
    * @param mapping
    *            An ActionMapping class that will be used by the Action class to tell the ActionServlet where to send
    *            the end-user.
    * @param form
    *            he ActionForm class that will contain any data submitted by the end-user via a form.
    * @param request
    *            A standard Servlet HttpServletRequest class.
    * @param response
    *            A standard Servlet HttpServletRequest class.
    * @return An ActionForward class that will be returned to the ActionServlet indicating where the user is to go
    *         next.
    * @throws IOException
    * @throws ServletException
    */
   public ActionForward openGateForSingleUser(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException {
monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext());

DynaActionForm gateForm = (DynaActionForm) form;
Long gateIdLong = (Long) gateForm.get(GateAction.ACTIVITY_FORM_FIELD);
String userId = (String) gateForm.get(GateAction.USER_ID);
String[] userIdsString = userId.split(",");
List<Integer> userIds = new LinkedList<Integer>();
for (String userIdString : userIdsString) {
    if (StringUtils.isNotBlank(userIdString)) {
	userIds.add(Integer.valueOf(userIdString));
    }
}
GateActivity gate = monitoringService.openGateForSingleUser(gateIdLong, userIds.toArray(new Integer[] {}));
return findViewByGateType(mapping, gateForm, gate);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:GateAction.java

示例5: removeItem

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Remove commonCartridge item from HttpSession list and update page display. As authoring rule, all persist only
    * happen when user submit whole page. So this remove is just impact HttpSession values.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward removeItem(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, CommonCartridgeConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);

int itemIdx = NumberUtils.stringToInt(request.getParameter(CommonCartridgeConstants.PARAM_ITEM_INDEX), -1);
if (itemIdx != -1) {
    SortedSet<CommonCartridgeItem> commonCartridgeList = getCommonCartridgeItemList(sessionMap);
    List<CommonCartridgeItem> rList = new ArrayList<CommonCartridgeItem>(commonCartridgeList);
    CommonCartridgeItem item = rList.remove(itemIdx);
    commonCartridgeList.clear();
    commonCartridgeList.addAll(rList);
    // add to delList
    List delList = getDeletedCommonCartridgeItemList(sessionMap);
    delList.add(item);
}

request.setAttribute(CommonCartridgeConstants.ATTR_SESSION_MAP_ID, sessionMapID);
return mapping.findForward(CommonCartridgeConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:AuthoringAction.java

示例6: execute

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
@Override
   public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws Exception {
String param = request.getParameter("method");
String customCSV = WebUtil.readStrParam(request, AttributeNames.PARAM_CUSTOM_CSV, true);
//-----------------------Resource Author function ---------------------------
if (StringUtils.equals(param, "import")) {
    if (customCSV != null) {
	request.setAttribute(AttributeNames.PARAM_CUSTOM_CSV, customCSV);
    }
    //display initial page for upload
    return mapping.findForward("upload");
} else {
    importLD(request);
    return mapping.findForward("success");
}
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:ImportToolContentAction.java

示例7: viewReflection

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

Long uid = WebUtil.readLongParam(request, ResourceConstants.ATTR_USER_UID);
Long sessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);

IResourceService service = getResourceService();
ResourceUser user = service.getUser(uid);
NotebookEntry notebookEntry = service.getEntry(sessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
	ResourceConstants.TOOL_SIGNATURE, user.getUserId().intValue());

ResourceSession session = service.getResourceSessionBySessionId(sessionID);

ReflectDTO refDTO = new ReflectDTO(user);
if (notebookEntry == null) {
    refDTO.setFinishReflection(false);
    refDTO.setReflect(null);
} else {
    refDTO.setFinishReflection(true);
    refDTO.setReflect(notebookEntry.getEntry());
}
refDTO.setReflectInstrctions(session.getResource().getReflectInstructions());

request.setAttribute("userDTO", refDTO);
return mapping.findForward("success");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:MonitoringAction.java

示例8: handleCancelCommand

import org.apache.struts.action.ActionForm; //导入依赖的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

示例9: disableSingleTutorialVideo

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Invoked when an user chose not to show a certain video again.
    *
    * @param mapping
    * @param form
    * @param req
    * @param res
    * @return
    */
   public ActionForward disableSingleTutorialVideo(ActionMapping mapping, ActionForm form, HttpServletRequest req,
    HttpServletResponse res) {

String pageString = WebUtil.readStrParam(req, AttributeNames.ATTR_PAGE_STR);

HttpSession ss = SessionManager.getSession();
UserDTO userDTO = (UserDTO) ss.getAttribute(AttributeNames.USER);
User user = getService().getUserByLogin(userDTO.getLogin());

user.getPagesWithDisabledTutorials().add(pageString);
getService().saveUser(user);

ss.setAttribute(AttributeNames.USER, user.getUserDTO());

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

示例10: execute

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
 * Process the specified HTTP request, and create the corresponding HTTP
 * response (or forward to another web component that will create it).
 * Return an <code>ActionForward</code> instance describing where and how
 * control should be forwarded, or <code>null</code> if the response has
 * already been completed.
 *
 * @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 an error occurs
 */
public ActionForward execute(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {

    // Create a RequestDispatcher the corresponding resource
    String path = mapping.getParameter();

    if (path == null) {
        throw new ServletException(messages.getMessage("forward.path"));
    }

    // Let the controller handle the request
    ActionForward retVal = new ActionForward(path);
    retVal.setContextRelative(true);

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

示例11: processPopulate

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
 * <p>Populate the properties of the specified <code>ActionForm</code> instance from
 * the request parameters included with this request.  In addition,
 * request attribute <code>Globals.CANCEL_KEY</code> will be set if
 * the request was submitted with a button created by
 * <code>CancelTag</code>.</p>
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are creating
 * @param form The ActionForm instance we are populating
 * @param mapping The ActionMapping we are using
 *
 * @exception ServletException if thrown by RequestUtils.populate()
 */
protected void processPopulate(HttpServletRequest request, HttpServletResponse response,
        ActionForm form, ActionMapping mapping) throws ServletException {
    if (form == null)
        return;

    // Populate the bean properties of this ActionForm instance
    if (log.isDebugEnabled())
        log.debug(" Populating bean properties from this request");

    form.setServlet(this.servlet);

    //*** Jaffa-customization: Moved in the custom populate method ***
    //form.reset(mapping, request);

    if (mapping.getMultipartClass() != null)
        request.setAttribute(Globals.MULTIPART_KEY, mapping.getMultipartClass());

    //*** Jaffa-customization: Invoke a custom version of the RequestUtils.populate() method, which will invoke the reset() method ***
    //RequestUtils.populate(form, mapping.getPrefix(), mapping.getSuffix(), request);
    customRequestUtilsPopulate(form, mapping.getPrefix(), mapping.getSuffix(), request, mapping);

    // Set the cancellation request attribute if appropriate
    if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) || (request.getParameter(Constants.CANCEL_PROPERTY_X) != null))
        request.setAttribute(Globals.CANCEL_KEY, Boolean.TRUE);
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:40,代码来源:CustomRequestProcessor.java

示例12: openNotebook

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

LearningForm lrnForm = (LearningForm) form;

// set the finished flag
ChatUser chatUser = LearningAction.chatService.getUserByUID(lrnForm.getChatUserUID());
ChatDTO chatDTO = new ChatDTO(chatUser.getChatSession().getChat());

request.setAttribute("chatDTO", chatDTO);

NotebookEntry notebookEntry = LearningAction.chatService.getEntry(chatUser.getChatSession().getSessionId(),
	CoreNotebookConstants.NOTEBOOK_TOOL, ChatConstants.TOOL_SIGNATURE, chatUser.getUserId().intValue());

if (notebookEntry != null) {
    lrnForm.setEntryText(notebookEntry.getEntry());
}

request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, chatUser.getChatSession().getSessionId());
LearningWebUtil.putActivityPositionInRequestByToolSessionId(chatUser.getChatSession().getSessionId(), request,
	getServlet().getServletContext());

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

示例13: toggleHideImage

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Opens a user's reflection
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   public ActionForward toggleHideImage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

setupService();
MonitoringForm monitorForm = (MonitoringForm) form;
PixlrUser pixlrUser = pixlrService.getUserByUID(monitorForm.getHideUserImageUid());

if (pixlrUser.isImageHidden()) {
    pixlrUser.setImageHidden(false);
} else {
    pixlrUser.setImageHidden(true);
}
pixlrService.saveOrUpdatePixlrUser(pixlrUser);
return unspecified(mapping, monitorForm, request, response);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:MonitoringAction.java

示例14: editCondition

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Display edit page for an existing condition.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward editCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

ForumConditionForm ForumConditionForm = (ForumConditionForm) form;
String sessionMapID = ForumConditionForm.getSessionMapID();
SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);

int orderId = NumberUtils.stringToInt(request.getParameter(ForumConstants.PARAM_ORDER_ID), -1);
ForumCondition condition = null;
if (orderId != -1) {
    SortedSet<ForumCondition> conditionSet = getForumConditionSet(sessionMap);
    List<ForumCondition> conditionList = new ArrayList<ForumCondition>(conditionSet);
    condition = conditionList.get(orderId);
    if (condition != null) {
	populateConditionToForm(orderId, condition, ForumConditionForm, request);
    }
}

populateFormWithPossibleItems(form, request);
return condition == null ? null : mapping.findForward("addcondition");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:AuthoringConditionAction.java

示例15: editImage

import org.apache.struts.action.ActionForm; //导入依赖的package包/类
/**
    * Display edit page for existed imageGallery item.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward editImage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, ImageGalleryConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);

int itemIdx = NumberUtils.stringToInt(request.getParameter(ImageGalleryConstants.PARAM_IMAGE_INDEX), -1);
ImageGalleryItem item = null;
if (itemIdx != -1) {
    SortedSet<ImageGalleryItem> imageGalleryList = getImageList(sessionMap);
    List<ImageGalleryItem> rList = new ArrayList<ImageGalleryItem>(imageGalleryList);
    item = rList.get(itemIdx);
    if (item != null) {
	populateItemToForm(itemIdx, item, (ImageGalleryItemForm) form, request);
    }
}
return (item == null) ? null : mapping.findForward("image");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:AuthoringAction.java


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