javaeetutorial
  1. javaeetutorial
  2. JAVAEETUTORIAL-226

Error in code example in advanced security chapter

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 7.0.1
    • Fix Version/s: 7.0.2
    • Component/s: None
    • Labels:
      None

      Description

      A user reports that there is an error in the code example in the advanced security chapter in this section: http://docs.oracle.com/javaee/7/tutorial/doc/security-advanced003.htm#BABIFJGI.

      The corrections are indicated by the comments at the end of the lines that contain the errors.

      @Stateless
      @ManagedBean // add annotation
      public class LoginBean {
      private String username;
      private String password;

      public String getUsername()

      { return this.username; }

      public void setUserName(String username)

      { this.username = username; }

      public String getPassword()

      { return this.password; }

      public void setPassword(String password)

      { //add String password this.password = password; }

        Activity

        Hide
        Ian Evans added a comment -

        I don't agree that it should be @ManagedBean in the code sample. Currently it is @Named, the replacement for JSF obsolete @ManagedBean annotation.

        If the user had problems that were solved by replacing @Named with @ManagedBean I suspect there might be an issue with CDI scanning. But that's a different issue.

        Show
        Ian Evans added a comment - I don't agree that it should be @ManagedBean in the code sample. Currently it is @Named , the replacement for JSF obsolete @ManagedBean annotation. If the user had problems that were solved by replacing @Named with @ManagedBean I suspect there might be an issue with CDI scanning. But that's a different issue.
        Hide
        jendrock added a comment -

        Ian's comment is correct. @Named should be used instead of @ManagedBean. The general recommendation is to use @Named regardless. Therefore, I will leave the existing annotation (@Named) as is.

        I did, however, make the second correction in the source. The correction should be visible when we publish the next update, very soon.

        Show
        jendrock added a comment - Ian's comment is correct. @Named should be used instead of @ManagedBean. The general recommendation is to use @Named regardless. Therefore, I will leave the existing annotation (@Named) as is. I did, however, make the second correction in the source. The correction should be visible when we publish the next update, very soon.
        Hide
        jendrock added a comment -

        The change has been made in the source and the correction will be visible at the next update.

        Show
        jendrock added a comment - The change has been made in the source and the correction will be visible at the next update.

          People

          • Assignee:
            jendrock
            Reporter:
            jendrock
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Due:
              Created:
              Updated:
              Resolved: