If you want it to return a String, do something like this. Also, @SessionState would not be necessary in a class like this. The @SessionState in your page class(es) will maintain the object for you.

public class User {
    private String user_id;

    public User getUser_id() { return user_id; }
    public void setUser_id(String user_id){ this.user_id = user_id; }
    public void setUser(User user){ this.user_id = user.getUser_id; }

}

If you haven't already done so at login or something along those lines before a user gets to the page in question, you'll want to do something like the following (maybe in onActivate rather, but I don't know your application) otherwise it would make sense that the @SessionState User user_id is null.

@SetupRender
void initUser(){
    if(user_id == null || user_id.getUser_id() == null){
        user_id = new User();
user_id.setUser_id( /* whatever the user_id String would be that you need to set */ );
    }
}

Yes I have a method like that but it keep's returning null, my user class:

          //These were originally strings but changed in an effort to get
working

        @SessionState
        private User user_id;

         public User getUser_id() {
                return user_id;
        }

        public void setUser_id(User user_id) {
                this.user_id = user_id;
        }

then the in my page:

         @SessionState
        private User user;

         @Property
        private String user_id;

         public User getUser() {
                return user;
        }
        
        public void setUser(User user) {
                this.user = user;
        }       

        prep.setString(1, user_id);








---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to