Example usage for javax.servlet.http HttpServletRequest setAttribute

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

Introduction

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

Prototype

public void setAttribute(String name, Object o);

Source Link

Document

Stores an attribute in this request.

Usage

From source file:net.sourceforge.fenixedu.presentationTier.Action.gesdis.TeachingReportAction.java

private void setSiteViewToRequest(HttpServletRequest request, SiteView siteView, ActionMapping mapping) {
    if (siteView != null) {
        request.setAttribute("siteView", siteView);
    }//from ww w  .  j a  v  a  2s  .  c  om
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.teacher.candidacy.erasmus.ErasmusCandidacyProcessDA.java

public DegreeCurricularPlan getDegreeCurricularPlan(HttpServletRequest request) {
    final String degreeCurricularPlanOID = DegreeCoordinatorIndex.findDegreeCurricularPlanID(request);
    request.setAttribute("degreeCurricularPlanID", degreeCurricularPlanOID);

    if (degreeCurricularPlanOID != null) {
        return FenixFramework.getDomainObject(degreeCurricularPlanOID);
    }//w  w  w  .jav a 2s . c om

    return null;
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.teacher.credits.ShowAllTeacherCreditsResumeAction.java

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    User userView = Authenticate.getUser();

    Teacher teacher = userView.getPerson().getTeacher();
    request.setAttribute("teacher", teacher);

    List<CreditLine> creditsLines = (List) ReadAllTeacherCredits.run(teacher.getExternalId());
    request.setAttribute("creditsLinesSize", creditsLines.size());

    BeanComparator dateComparator = new BeanComparator("executionPeriod.beginDate");
    Iterator orderedCreditsLines = new OrderedIterator(creditsLines.iterator(), dateComparator);

    request.setAttribute("creditsLines", orderedCreditsLines);
    return mapping.findForward("show-all-credits-resume");
}

From source file:dicky.controlleradmin.ProductAdminController.java

@RequestMapping(value = "edit/{idProduct}", method = RequestMethod.GET)
public String edit(HttpServletRequest request, @PathVariable(value = "idProduct") String idProduct,
        ModelMap modelMap) throws ServletException, IOException {
    request.setAttribute("product", this.productService.findId(idProduct));
    modelMap.put("kategoris", kategoriService.findAll());
    return "admin.product.edit";
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.manager.ManageRolesDA.java

public ActionForward prepareAddRoleToPerson(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    request.setAttribute(PresentationConstants.ROLES, rootDomainObject.getRolesSet());
    return mapping.findForward("Manage");
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.teacher.ListVigilanciesForEvaluationDispatchAction.java

private void setState(HttpServletRequest request) {
    String executionCourseID = request.getParameter("executionCourseID");
    request.setAttribute("executionCourseID", executionCourseID);
    String writtenEvaluationID = request.getParameter("evaluationOID");
    WrittenEvaluation evaluation = (WrittenEvaluation) FenixFramework.getDomainObject(writtenEvaluationID);

    ComparatorChain comparator = new ComparatorChain();
    comparator.addComparator(Vigilancy.COMPARATOR_BY_VIGILANT_CATEGORY);
    comparator.addComparator(Vigilancy.COMPARATOR_BY_VIGILANT_USERNAME);

    List<Vigilancy> vigilancies = new ArrayList<Vigilancy>(evaluation.getOthersVigilancies());
    Collections.sort(vigilancies, comparator);
    List<Vigilancy> ownVigilancies = new ArrayList<Vigilancy>(evaluation.getTeachersVigilancies());
    Collections.sort(ownVigilancies, comparator);

    request.setAttribute("evaluation", evaluation);
    request.setAttribute("ownVigilancies", ownVigilancies);
    request.setAttribute("vigilancies", vigilancies);
}

From source file:com.google.publicalerts.cap.validator.CapValidatorServlet.java

@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    req.setAttribute("input", "");
    req.setAttribute("profiles", ValidatorUtil.getProfilesJsp(null));
    render(req, resp);//  w w  w  . j a v a  2 s . c om
}

From source file:com.seer.datacruncher.profiler.spring.ProfilerInfoController.java

public Vector[] getDistributionValues(QueryBuilder querybuilder, HttpServletRequest request) {
    Vector avector[] = FirstInformation.getDistributionValues(querybuilder);

    request.setAttribute("minValue", FirstInformation.getMinVal());
    request.setAttribute("maxValue", FirstInformation.getMaxVal());

    return avector;
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.commons.ChooseMasterDegreeToSelectCandidatesDA.java

public ActionForward prepareChooseMasterDegree(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    String executionYear = getFromRequest("executionYear", request);

    request.setAttribute("jspTitle", getFromRequest("jspTitle", request));
    request.setAttribute("executionYear", executionYear);

    // Get the Degree List

    User userView = getUserView(request);
    List degreeList = null;// www  .java 2 s .c o m
    try {

        degreeList = ReadMasterDegrees.run(executionYear);
        // ver aqui o que devolvs o servico
    } catch (NonExistingServiceException e) {

        ActionErrors errors = new ActionErrors();
        errors.add("nonExisting", new ActionError("message.masterDegree.notfound.degrees", executionYear));
        saveErrors(request, errors);
        return mapping.getInputForward();

    } catch (ExistingServiceException e) {
        throw new ExistingActionException(e);
    }
    Collections.sort(degreeList, new BeanComparator("infoDegreeCurricularPlan.infoDegree.nome"));

    request.setAttribute(PresentationConstants.DEGREE_LIST, degreeList);

    return mapping.findForward("PrepareSuccess");
}

From source file:com.redhat.rhn.frontend.action.systems.duplicate.DuplicateSystemsAction.java

/**
 *
 * {@inheritDoc}/*from  ww  w .jav a  2 s. co  m*/
 */
public ActionForward execute(ActionMapping mapping, ActionForm formIn, HttpServletRequest request,
        HttpServletResponse response) {

    RequestContext ctx = new RequestContext(request);
    request.setAttribute(mapping.getParameter(), mapping.getParameter());

    long inactiveHours = 24;
    if (request.getParameter(INACTIVE_COUNT) != null) {
        inactiveHours = Long.parseLong(request.getParameter(INACTIVE_COUNT));
    }
    request.setAttribute(INACTIVE_COUNT, inactiveHours);

    ListRhnSetHelper helper = new ListRhnSetHelper(this, request, getSetDecl());
    helper.setWillClearSet(false);
    helper.execute();
    if (helper.isDispatched()) {
        return mapping.findForward(RhnHelper.CONFIRM_FORWARD);
    }

    String inactiveButton = ListTagUtil.makeExtraButtonName(helper.getUniqueName());
    if (!StringUtils.isBlank(request.getParameter(inactiveButton))) {
        List<DuplicateSystemGrouping> list = getResult(ctx);

        RhnSet set = helper.getSet();
        for (DuplicateSystemGrouping grp : list) {
            for (NetworkDto dto : grp.getSystems()) {
                if (dto.getInactive() > 0) {
                    set.add(dto.getId().toString());
                }
            }
        }

        RhnSetManager.store(set);
        helper.resync(request);

    }

    request.setAttribute(inactiveButton, "system.select.inactive");
    return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
}