本文整理汇总了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");
}
示例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");
}
示例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;
}
示例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);
}
示例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);
}
示例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");
}
}
示例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");
}
示例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");
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}
示例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);
}
示例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");
}
示例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");
}