public void updateLaw() {
    lawService.edit(curLaws);

    try {
      FacesContext.getCurrentInstance()
          .getExternalContext()
          .redirect("/RADAAPP-war/faces/Laws.xhtml");

    } catch (IOException ex) {
      Logger.getLogger(UsersManagedBean.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  @PostConstruct
  public void init() {
    String id_law =
        ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest())
            .getParameter("id_laws");
    Long id = new Long(id_law);
    try {
      curLaws = (Laws) lawService.find(Long.valueOf(id));
      // lstComm = commentService.getByPublication(currentPubl);
      System.out.println(
          ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest())
              .getQueryString());

    } catch (Exception e) {
      e.getStackTrace();
    }
  }
Beispiel #3
0
  public void addLaws() {
    //    Users usr = new Users();
    //   System.out.print("sdgfvergbet");

    if ((currLaw.getDescript() != null) || (null != currLaw.getTitle())) {
      currLaw.setAvtor(usrMB.getCurrentUser());
      lawService.create(currLaw);
      try {
        FacesContext.getCurrentInstance()
            .getExternalContext()
            .redirect("/RADAAPP-war/faces/Laws.xhtml");

      } catch (IOException ex) {
        Logger.getLogger(UsersManagedBean.class.getName()).log(Level.SEVERE, null, ex);
      }

    } else JsfUtil.addErrorMessage("Put some text and title!");
  }