Session State not setting user?
){ String statement8 = Update private set user9=?;; prep = conn.prepareStatement(statement8); prep.setString(1, user.getUsername()); prep.executeUpdate(); } else if(user10 == null){ String statement9 = Update private set user10=?;; prep = conn.prepareStatement(statement9); prep.setString(1, user.getUsername()); prep.executeUpdate(); } } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3698456.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
@SessionState/@Property only works in Pages, Components and Mixins. To access session state objects in your services you need to inject the ApplicationStateManager g, kris Von:robnangle robnan...@gmail.com An: users@tapestry.apache.org Datum: 15.03.2011 12:28 Betreff:Session State not setting user? Hi, I am using at session state throughout my application but in one class it does not seem to be setting/getting the user in one class? Any idea's? public class JoinLeague { private Connection conn; private PreparedStatement prep; @Property @SessionState private User user; private PrivateLeague temp; private String user2; private String user3; private String user4; private String user5; private String user6; private String user7; private String user8; private String user9; private String user10; public JoinLeague() throws Exception { createDb(); conn.close(); } public void createDb() throws Exception { Handler handler = new Handler(); conn = handler.getConnection(); prep = handler.getPreparedStatement(); } public void assignUsers() throws Exception { try { createDb(); String statement = select * from private; prep = conn.prepareStatement(statement); ResultSet rs = (ResultSet) prep.executeQuery(); while(rs.next()) { temp = new PrivateLeague(); temp.setMem2(rs.getString(user2)); user2 = temp.getMem2(); temp.setMem3(rs.getString(user3)); user3 = temp.getMem3(); temp.setMem4(rs.getString(user4)); user4 = temp.getMem4(); temp.setMem5(rs.getString(user5)); user5 = temp.getMem5(); temp.setMem6(rs.getString(user6)); user6 = temp.getMem6(); temp.setMem7(rs.getString(user7)); user7 = temp.getMem7(); temp.setMem8(rs.getString(user8)); user8 = temp.getMem8(); temp.setMem9(rs.getString(user9)); user9 = temp.getMem9(); temp.setMem10(rs.getString(user10)); user10 = temp.getMem10(); } conn.close(); } catch (Exception e) { e.printStackTrace(); } } public void updateUsers() throws Exception { createDb(); if(user2 == null) { String statement1 = Update private set user2=?;; prep = conn.prepareStatement(statement1); prep.setString(1, user.getUsername()); prep.executeUpdate(); } else if(user3 == null){ String statement2 = Update private set user3=?;; prep = conn.prepareStatement(statement2); prep.setString(1, user.getUsername()); prep.executeUpdate(); } else if(user4 == null){ String statement3 = Update private set user4=?;; prep = conn.prepareStatement(statement3); prep.setString(1, user.getUsername()); prep.executeUpdate
Re: Session State not setting user?
Cheers.. Is that difficult done? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3699526.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
just declare it in your constructor and create your service with tapestry ioc. take a look at the tapestry ioc documentation to see how injection works g, kris Von:robnangle robnan...@gmail.com An: users@tapestry.apache.org Datum: 15.03.2011 12:49 Betreff:Re: Session State not setting user? Cheers.. Is that difficult done? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3699526.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
@Inject private ApplicationStateManager stateManager; User user = stateManager.get(User.class); On Tue, 2011-03-15 at 12:54 +0100, Kristian Marinkovic wrote: just declare it in your constructor and create your service with tapestry ioc. take a look at the tapestry ioc documentation to see how injection works g, kris Von:robnangle robnan...@gmail.com An: users@tapestry.apache.org Datum: 15.03.2011 12:49 Betreff:Re: Session State not setting user? Cheers.. Is that difficult done? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3699526.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
Can it be used aswel as @SessionState? And in the other class how do i get the user then? Just inject it? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3701009.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org