Example usage for javax.servlet.http HttpServletRequest removeAttribute

List of usage examples for javax.servlet.http HttpServletRequest removeAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest removeAttribute.

Prototype

public void removeAttribute(String name);

Source Link

Document

Removes an attribute from this request.

Usage

From source file:com.glaf.oa.travelfee.web.springmvc.TravelfeeController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");

    Travelfee travelfee = travelfeeService.getTravelfee(RequestUtils.getLong(request, "feeid"));
    if (travelfee != null) {
        request.setAttribute("travelfee", travelfee);
        JSONObject rowJSON = travelfee.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }/*from  w  w  w . j  ava  2 s. com*/

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("travelfee.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/travelfee/edit", modelMap);
}

From source file:com.etcc.csc.presentation.action.GetTollTagRetrieveVehicleAction.java

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    DynaActionForm actionForm = (DynaActionForm) form;
    String vehicleIndex = request.getParameter("vehicleIndex");
    TagDTO tagDTO = retrieveVehicle(vehicleIndex, request);
    if (request.getAttribute("deleteAllowed") != null)
        request.removeAttribute("deleteAllowed");

    actionForm.set("licensePlate", tagDTO.getLicPlate());
    actionForm.set("licensePlateState", tagDTO.getLicState());
    actionForm.set("tempLicensePlate", Boolean.valueOf(tagDTO.isTemporaryLicPlate()));
    if (tagDTO.isTemporaryLicPlate()) {
        actionForm.set("tempLicensePlateExpireDate",
                new SimpleDateFormat("MM/dd/yyyy").format(tagDTO.getPlateExpirDate().getTime()));
    }/* w  w w.  j ava2s  . co m*/
    actionForm.set("vehicleYear", tagDTO.getVehicleYear());
    actionForm.set("vehicleColor", tagDTO.getVehicleColor());
    actionForm.set("vehicleMake", tagDTO.getVehicleMake());
    actionForm.set("vehicleModel", tagDTO.getVehicleModel());
    actionForm.set("vehicleClassCode", tagDTO.getVehicleClassCode());
    actionForm.set("deleteVehicle", Boolean.valueOf(false));
    actionForm.set("vehicleIndexToModify", vehicleIndex);

    if (StringUtils.isEmpty(tagDTO.getTagId())) {
        System.out.println(
                "hi in gettolltag retrive vehilcle,tag value" + tagDTO.getTagId() + "deleteAllowed=yes");
        request.setAttribute("deleteAllowed", new String("yes"));
    } else if (Integer.parseInt(tagDTO.getTagId()) > 0) {
        System.out.println(
                "hi in gettolltag retrive vehilcle,tag value" + tagDTO.getTagId() + "deleteAllowed=no");
        request.setAttribute("deleteAllowed", new String("no"));
    }

    request.setAttribute("vehicleIndex", vehicleIndex);
    StateInterface si = (StateInterface) DelegateFactory.create(DelegateEnum.STATE_DELEGATE);
    VehicleInterface vi = (VehicleInterface) DelegateFactory.create(DelegateEnum.VEHICLE_DELEGATE);
    String localeStr = SessionUtil.getStrutsLocaleLang(request);
    request.setAttribute("states", si.getStates());
    Collection vehicleClasses = vi.getVehicleClasses(localeStr);
    request.setAttribute("vehicleClasses", vehicleClasses);
    setVehicleClassDesc((Map) request.getSession().getAttribute("savedVehicles"), vehicleClasses);

    return mapping.findForward("success");
}

From source file:org.zkoss.zk.grails.web.ZULUrlMappingsFilter.java

private void reapplySitemesh(HttpServletRequest request) {
    request.removeAttribute("com.opensymphony.sitemesh.APPLIED_ONCE");
}

From source file:com.glaf.oa.reimbursement.web.springmvc.ReimbursementApproveController.java

@RequestMapping("/approve")
public ModelAndView approve(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");
    Reimbursement reimbursement = reimbursementService
            .getReimbursement(RequestUtils.getLong(request, "reimbursementid"));

    if (reimbursement.getBrands1() != null && reimbursement.getBrands2() != null) {
        reimbursement.setBrand("MUL");
    }//from w ww .ja va 2 s .com

    request.setAttribute("reimbursement", reimbursement);
    JSONObject rowJSON = reimbursement.toJsonObject();
    request.setAttribute("x_json", rowJSON.toJSONString());

    return new ModelAndView("/oa/reimbursement/approve_edit", modelMap);
}

From source file:nl.nn.adapterframework.webcontrol.action.ActionBase.java

/**
 * removes formbean <br/>/*from  w w w  .  j a  v a2 s . com*/
 * removes what is defined under the Attribute of a mapping from either the
 * request or the session
 */
public void removeFormBean(ActionMapping mapping, HttpServletRequest request) {
    HttpSession session = request.getSession();

    if (mapping.getAttribute() != null) {
        if ("request".equals(mapping.getScope()))
            request.removeAttribute(mapping.getAttribute());
        else
            session.removeAttribute(mapping.getAttribute());
    }
}

From source file:org.grails.web.errors.GrailsExceptionResolver.java

@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
        Exception ex) {/*from w w  w .  j a v a 2  s  .  com*/
    // don't reuse cached controller attribute 
    request.removeAttribute(GrailsApplicationAttributes.GRAILS_CONTROLLER_CLASS_AVAILABLE);

    ex = findWrappedException(ex);

    filterStackTrace(ex);

    ModelAndView mv = super.resolveException(request, response, handler, ex);

    setStatus(request, response, mv, ex);

    logStackTrace(ex, request);

    UrlMappingsHolder urlMappings = lookupUrlMappings();
    if (urlMappings != null) {
        mv = resolveViewOrForward(ex, urlMappings, request, response, mv);
    }

    return mv;
}

From source file:com.glaf.oa.purchase.web.springmvc.PurchaseitemController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");
    Purchaseitem purchaseitem = purchaseitemService
            .getPurchaseitem(RequestUtils.getLong(request, "purchaseitemid"));
    if (purchaseitem != null) {
        request.setAttribute("purchaseitem", purchaseitem);
        JSONObject rowJSON = purchaseitem.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }/*from ww  w .  j a  va 2  s . c  om*/

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    if (StringUtils.containsIgnoreCase(x_method, "update")) {
        if (purchaseitem != null) {

        }
    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("purchaseitem.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/purchaseitem/edit", modelMap);
}

From source file:com.glaf.core.web.springmvc.MxMembershipController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");

    Membership membership = membershipService.getMembership(RequestUtils.getLong(request, "rowId"));
    if (membership != null) {
        request.setAttribute("membership", membership);
        JSONObject rowJSON = membership.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }//from w  ww . j ava  2s  .  c o m

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("membership.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/modules/sys/membership/edit", modelMap);
}

From source file:com.glaf.oa.reimbursement.web.springmvc.RitemController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");
    Ritem ritem = ritemService.getRitem(RequestUtils.getLong(request, "ritemid"));
    if (ritem != null) {
        request.setAttribute("ritem", ritem);
        JSONObject rowJSON = ritem.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }/* w  ww.  j  av  a 2s  .  co m*/

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    if (StringUtils.containsIgnoreCase(x_method, "update")) {
        if (ritem != null) {
        }
    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("ritem.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/ritem/edit", modelMap);
}

From source file:com.glaf.oa.optional.web.springmvc.OptionalController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");

    Optional optional = optionalService.getOptional(RequestUtils.getInt(request, "optionalId"));
    if (optional != null) {
        request.setAttribute("optional", optional);
        JSONObject rowJSON = optional.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }/* ww  w  . j  a  v a 2s  .com*/

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    if (StringUtils.containsIgnoreCase(x_method, "update")) {
        if (optional != null) {
            canUpdate = true;
        }
    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("optional.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/optional/edit", modelMap);
}