I've made both but it doesn't work
i.ve added
${user.getUserName} and on another  page there is "merchantregform Start
PageApplicationStateManager "

On Wed, Sep 3, 2008 at 2:56 PM, Hugo Palma <[EMAIL PROTECTED]> wrote:

> You have two ways of setting the currUser DAO:
>
> 1. Copy fields from one object to another.
> Just add this to your code:
>
> currUser.setUsername(user.getUsername);
> currUser.setPassword(user.getPassword);
> .....
>
> You don't have to assign the currUser field. That will the done for you by
> Tapestry.
>
> 2. Declare the ASO like this:
>
> @ApplicationState(created=false)
> private User currUser;
>
> assign the field like this:
>
> currUser = u;
>
>
> Natia Gdzelishvili wrote:
>
>> I've tried to do this:
>> currUser=new User();
>> and then set some values but it does not work...
>>
>> On Wed, Sep 3, 2008 at 2:26 PM, Natia Gdzelishvili
>> <[EMAIL PROTECTED]>wrote:
>>
>>
>>
>>> I'm not using userExists,
>>> in tapestry 5.0.9 everything was working, i was doing the same
>>>
>>>
>>> On Wed, Sep 3, 2008 at 1:24 PM, Fernando Padilla <[EMAIL PROTECTED]
>>> >wrote:
>>>
>>>
>>>
>>>> Also, i thought you were to think of an ASO almost as a singleton or a
>>>> service.  Tapestry will create it for you on first access.  I didn't
>>>> know
>>>> you could set it.  Even if I'm wrong, using this design pattern might
>>>> clean
>>>> things up a little.
>>>>
>>>>
>>>> So you should use another class to contain a reference to the current
>>>> active user, call it "UserContainer".
>>>>
>>>>
>>>> @AplicationState
>>>> private UserContainer currUser;
>>>>
>>>>
>>>> and it would have methods like:
>>>>
>>>> currUser.hasUser()
>>>> currUser.setUser(User user)
>>>> currUser.getUser()
>>>>
>>>>
>>>> or whatever you like.
>>>>
>>>>
>>>>
>>>>
>>>> José Paumard wrote:
>>>>
>>>>
>>>>
>>>>> Natia,
>>>>>
>>>>> I think there is a mistake in your code :
>>>>>
>>>>> private User currUser ;
>>>>> private boolean userExists ;
>>>>>
>>>>> I dont think T5 will link userExists and currUser, currUser should be
>>>>> named user, or userExists currUserExists (please correct me if I'm
>>>>> wrong).
>>>>>
>>>>> That said, what do you mean "I cant access currUser", do you mean that
>>>>> the ASO is null in other classes that want to read it ? Or do you mean
>>>>> that
>>>>> userExists is always false (which is normal, see above).
>>>>>
>>>>> José
>>>>>
>>>>> Natia Gdzelishvili a écrit :
>>>>>
>>>>>
>>>>>
>>>>>> I'm using tapestry 5.0.14 ,i vahe problem with aso, my code is:
>>>>>>
>>>>>> public class Login {
>>>>>>   private String username;
>>>>>>   private String password;
>>>>>>   @Inject
>>>>>>   private IBusinessServicesLocator _businessServicesLocator;
>>>>>>   @ApplicationState
>>>>>>   private User currUser;
>>>>>>   private boolean userExists;
>>>>>>
>>>>>>
>>>>>>   public String getUsername() {
>>>>>>       return username;
>>>>>>   }
>>>>>>
>>>>>>   public void setUsername(String username) {
>>>>>>       this.username = username;
>>>>>>   }
>>>>>>
>>>>>>   public String getPassword() {
>>>>>>       return password;
>>>>>>   }
>>>>>>
>>>>>>   public void setPassword(String password) {
>>>>>>       this.password = password;
>>>>>>   }
>>>>>>
>>>>>>   @SuppressWarnings("unchecked")
>>>>>>   @OnEvent(value = "submit", component = "loginForm")
>>>>>>   public Object submitLoginForm() {
>>>>>>       Class nextPage;
>>>>>>       try {
>>>>>>           User u=getMerchantCreator().login(username, password);
>>>>>> //*returns
>>>>>> some object*
>>>>>>           currUser = u; /*/ currUser object cannot be resolved*
>>>>>>           nextPage = ViewAllMerchants.class;
>>>>>>
>>>>>>       } catch (UserNotFoundException e) {
>>>>>>           nextPage = Login.class;
>>>>>>           e.printStackTrace();
>>>>>>       }
>>>>>>       return nextPage;
>>>>>>   }
>>>>>>
>>>>>>   private IMerchantCreatorLocal getMerchantCreator() {
>>>>>>       return _businessServicesLocator.getMerchantCreatorLocal();
>>>>>>   }
>>>>>> }
>>>>>>
>>>>>> i cannot access curruser...
>>>>>> please help..
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>

Reply via email to