You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Koen Segers <Ko...@scarlet.be> on 2005/01/29 13:28:35 UTC

visit problem

Hi, 

I have a problem with my visit object.
In my visit object I store a reference to a MenuGenerator object.
In visit's constructor I have a new MenuGenerator();

I also have a MenuGeneratorAdmin() which generates the menu if a admin is 
logged in.
If a user is logged in I reset the pointer to the sort of user he is. For the 
admin example: visit.setMenuGenerator(new MenuGeneratorAdmin());

The problem is that I still get the same menu...
The request is done, but for the wrong generator.

I have changed the constructor of visit so that he gets new 
MenuGeneratorAdmin() and then the menu was correct.

I don't know what the problem is.
Must I give some extra settings to the visit object to store this pointer?

Greetz

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: visit problem

Posted by Koen Segers <Ko...@scarlet.be>.
On Saturday 29 January 2005 21:01, Jamie Orchard-Hays wrote:
> I suspect what you mean to use is if(authlevel.equals("1"))...
>
> even better is if ("1".equals(authlevel) ) since "1" will never be null

Nice! 
That was the problem idd
Thx man!

>
> On Jan 29, 2005, at 2:53 PM, Jamie Orchard-Hays wrote:
> > Since your set and getmenuGenerator() look fine, the perhaps none of
> > your if/else statements are being caught. Since the visit is just a
> > POJO, why don't you write a unit test to see if you can find the
> > problem?
> >
> > Jamie
> >
> > On Jan 29, 2005, at 2:29 PM, Koen Segers wrote:
> >> This is login and visit. These two work together to create the
> >> correct menu. I
> >> know it sounds a bit overkill, but more menus are added later ...
> >>
> >> Login:
> >> Visit visit = (Visit)getVisit();
> >> visit.setUserID(ID);
> >> if (authlevel == "1"){
> >>  visit.setMenuGenerator(new MenuGeneratorStudent());
> >> }
> >> else if (authlevel=="2"){
> >>  visit.setMenuGenerator(new MenuGeneratorTeacher());
> >> }
> >> else if (authlevel=="3"){
> >>  visit.setMenuGenerator(new MenuGeneratorAdmin());
> >> }
> >> loginmessage+="You are authorized.<br>";
> >> loginmessage+="Your id is " + visit.getUserID()+"<br>";
> >> loginmessage+="Your authentication level is " + authlevel;
> >>
> >> Visit:
> >> public class Visit {
> >> private String fUserID;
> >> private MenuGenerator fMenuGenerator;
> >>
> >> public Visit(){
> >>  fMenuGenerator = new MenuGenerator();
> >> }
> >>
> >> public MenuGenerator getMenuGenerator() {
> >>   return fMenuGenerator;
> >> }
> >>
> >> public void setMenuGenerator(MenuGenerator menuGenerator) {
> >>  fMenuGenerator = menuGenerator;
> >> }
> >>
> >> On Saturday 29 January 2005 13:55, Todd O'Bryan wrote:
> >>> Can you post (the appropriate parts of) your Visit code, and the
> >>> method
> >>> that gets called when the user logs in? We'll need to see how those
> >>> interact.
> >>>
> >>> Todd
> >>>
> >>> On Jan 29, 2005, at 7:28 AM, Koen Segers wrote:
> >>>> Hi,
> >>>>
> >>>> I have a problem with my visit object.
> >>>> In my visit object I store a reference to a MenuGenerator object.
> >>>> In visit's constructor I have a new MenuGenerator();
> >>>>
> >>>> I also have a MenuGeneratorAdmin() which generates the menu if a
> >>>> admin
> >>>> is
> >>>> logged in.
> >>>> If a user is logged in I reset the pointer to the sort of user he
> >>>> is.
> >>>> For the
> >>>> admin example: visit.setMenuGenerator(new MenuGeneratorAdmin());
> >>>>
> >>>> The problem is that I still get the same menu...
> >>>> The request is done, but for the wrong generator.
> >>>>
> >>>> I have changed the constructor of visit so that he gets new
> >>>> MenuGeneratorAdmin() and then the menu was correct.
> >>>>
> >>>> I don't know what the problem is.
> >>>> Must I give some extra settings to the visit object to store this
> >>>> pointer?
> >>>>
> >>>> Greetz
> >>>>
> >>>> --
> >>>>
> >>>> Koen Segers
> >>>>
> >>>> <ko...@scarlet.be>
> >>>> <http://eddyvite.dyndns.org>
> >>>>
> >>>> --------------------------------------------------------------------
> >>>> -
> >>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>>> For additional commands, e-mail:
> >>>> tapestry-user-help@jakarta.apache.org
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail:
> >>> tapestry-user-help@jakarta.apache.org
> >>
> >> --
> >>
> >> Koen Segers
> >>
> >> <ko...@scarlet.be>
> >> <http://eddyvite.dyndns.org>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: visit problem

Posted by Jamie Orchard-Hays <ja...@dang.com>.
I suspect what you mean to use is if(authlevel.equals("1"))...

even better is if ("1".equals(authlevel) ) since "1" will never be null


On Jan 29, 2005, at 2:53 PM, Jamie Orchard-Hays wrote:

> Since your set and getmenuGenerator() look fine, the perhaps none of  
> your if/else statements are being caught. Since the visit is just a  
> POJO, why don't you write a unit test to see if you can find the  
> problem?
>
> Jamie
>
> On Jan 29, 2005, at 2:29 PM, Koen Segers wrote:
>
>> This is login and visit. These two work together to create the  
>> correct menu. I
>> know it sounds a bit overkill, but more menus are added later ...
>>
>> Login:
>> Visit visit = (Visit)getVisit();
>> visit.setUserID(ID);
>> if (authlevel == "1"){
>>  visit.setMenuGenerator(new MenuGeneratorStudent());
>> }
>> else if (authlevel=="2"){
>>  visit.setMenuGenerator(new MenuGeneratorTeacher());
>> }
>> else if (authlevel=="3"){
>>  visit.setMenuGenerator(new MenuGeneratorAdmin());
>> }
>> loginmessage+="You are authorized.<br>";
>> loginmessage+="Your id is " + visit.getUserID()+"<br>";
>> loginmessage+="Your authentication level is " + authlevel;
>>
>> Visit:
>> public class Visit {
>> private String fUserID;
>> private MenuGenerator fMenuGenerator;
>>
>> public Visit(){
>>  fMenuGenerator = new MenuGenerator();
>> }
>>
>> public MenuGenerator getMenuGenerator() {
>>   return fMenuGenerator;
>> }
>>
>> public void setMenuGenerator(MenuGenerator menuGenerator) {
>>  fMenuGenerator = menuGenerator;
>> }
>>
>> On Saturday 29 January 2005 13:55, Todd O'Bryan wrote:
>>> Can you post (the appropriate parts of) your Visit code, and the  
>>> method
>>> that gets called when the user logs in? We'll need to see how those
>>> interact.
>>>
>>> Todd
>>>
>>> On Jan 29, 2005, at 7:28 AM, Koen Segers wrote:
>>>> Hi,
>>>>
>>>> I have a problem with my visit object.
>>>> In my visit object I store a reference to a MenuGenerator object.
>>>> In visit's constructor I have a new MenuGenerator();
>>>>
>>>> I also have a MenuGeneratorAdmin() which generates the menu if a  
>>>> admin
>>>> is
>>>> logged in.
>>>> If a user is logged in I reset the pointer to the sort of user he  
>>>> is.
>>>> For the
>>>> admin example: visit.setMenuGenerator(new MenuGeneratorAdmin());
>>>>
>>>> The problem is that I still get the same menu...
>>>> The request is done, but for the wrong generator.
>>>>
>>>> I have changed the constructor of visit so that he gets new
>>>> MenuGeneratorAdmin() and then the menu was correct.
>>>>
>>>> I don't know what the problem is.
>>>> Must I give some extra settings to the visit object to store this
>>>> pointer?
>>>>
>>>> Greetz
>>>>
>>>> --
>>>>
>>>> Koen Segers
>>>>
>>>> <ko...@scarlet.be>
>>>> <http://eddyvite.dyndns.org>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail:  
>>>> tapestry-user-help@jakarta.apache.org
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:  
>>> tapestry-user-help@jakarta.apache.org
>>
>> -- 
>>
>> Koen Segers
>>
>> <ko...@scarlet.be>
>> <http://eddyvite.dyndns.org>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: visit problem

Posted by Jamie Orchard-Hays <ja...@dang.com>.
Since your set and getmenuGenerator() look fine, the perhaps none of 
your if/else statements are being caught. Since the visit is just a 
POJO, why don't you write a unit test to see if you can find the 
problem?

Jamie

On Jan 29, 2005, at 2:29 PM, Koen Segers wrote:

> This is login and visit. These two work together to create the correct 
> menu. I
> know it sounds a bit overkill, but more menus are added later ...
>
> Login:
> Visit visit = (Visit)getVisit();
> visit.setUserID(ID);
> if (authlevel == "1"){
>  visit.setMenuGenerator(new MenuGeneratorStudent());
> }
> else if (authlevel=="2"){
>  visit.setMenuGenerator(new MenuGeneratorTeacher());
> }
> else if (authlevel=="3"){
>  visit.setMenuGenerator(new MenuGeneratorAdmin());
> }
> loginmessage+="You are authorized.<br>";
> loginmessage+="Your id is " + visit.getUserID()+"<br>";
> loginmessage+="Your authentication level is " + authlevel;
>
> Visit:
> public class Visit {
> private String fUserID;
> private MenuGenerator fMenuGenerator;
>
> public Visit(){
>  fMenuGenerator = new MenuGenerator();
> }
>
> public MenuGenerator getMenuGenerator() {
>   return fMenuGenerator;
> }
>
> public void setMenuGenerator(MenuGenerator menuGenerator) {
>  fMenuGenerator = menuGenerator;
> }
>
> On Saturday 29 January 2005 13:55, Todd O'Bryan wrote:
>> Can you post (the appropriate parts of) your Visit code, and the 
>> method
>> that gets called when the user logs in? We'll need to see how those
>> interact.
>>
>> Todd
>>
>> On Jan 29, 2005, at 7:28 AM, Koen Segers wrote:
>>> Hi,
>>>
>>> I have a problem with my visit object.
>>> In my visit object I store a reference to a MenuGenerator object.
>>> In visit's constructor I have a new MenuGenerator();
>>>
>>> I also have a MenuGeneratorAdmin() which generates the menu if a 
>>> admin
>>> is
>>> logged in.
>>> If a user is logged in I reset the pointer to the sort of user he is.
>>> For the
>>> admin example: visit.setMenuGenerator(new MenuGeneratorAdmin());
>>>
>>> The problem is that I still get the same menu...
>>> The request is done, but for the wrong generator.
>>>
>>> I have changed the constructor of visit so that he gets new
>>> MenuGeneratorAdmin() and then the menu was correct.
>>>
>>> I don't know what the problem is.
>>> Must I give some extra settings to the visit object to store this
>>> pointer?
>>>
>>> Greetz
>>>
>>> --
>>>
>>> Koen Segers
>>>
>>> <ko...@scarlet.be>
>>> <http://eddyvite.dyndns.org>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: 
>>> tapestry-user-help@jakarta.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> -- 
>
> Koen Segers
>
> <ko...@scarlet.be>
> <http://eddyvite.dyndns.org>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: visit problem

Posted by Koen Segers <Ko...@scarlet.be>.
This is login and visit. These two work together to create the correct menu. I 
know it sounds a bit overkill, but more menus are added later ...

Login:
Visit visit = (Visit)getVisit();
visit.setUserID(ID);
if (authlevel == "1"){
 visit.setMenuGenerator(new MenuGeneratorStudent());
}
else if (authlevel=="2"){
 visit.setMenuGenerator(new MenuGeneratorTeacher());
}
else if (authlevel=="3"){
 visit.setMenuGenerator(new MenuGeneratorAdmin());
}
loginmessage+="You are authorized.<br>";
loginmessage+="Your id is " + visit.getUserID()+"<br>";
loginmessage+="Your authentication level is " + authlevel;

Visit:
public class Visit {
private String fUserID;
private MenuGenerator fMenuGenerator;

public Visit(){
 fMenuGenerator = new MenuGenerator();
}

public MenuGenerator getMenuGenerator() {
  return fMenuGenerator;
}
 
public void setMenuGenerator(MenuGenerator menuGenerator) {
 fMenuGenerator = menuGenerator;
}

On Saturday 29 January 2005 13:55, Todd O'Bryan wrote:
> Can you post (the appropriate parts of) your Visit code, and the method
> that gets called when the user logs in? We'll need to see how those
> interact.
>
> Todd
>
> On Jan 29, 2005, at 7:28 AM, Koen Segers wrote:
> > Hi,
> >
> > I have a problem with my visit object.
> > In my visit object I store a reference to a MenuGenerator object.
> > In visit's constructor I have a new MenuGenerator();
> >
> > I also have a MenuGeneratorAdmin() which generates the menu if a admin
> > is
> > logged in.
> > If a user is logged in I reset the pointer to the sort of user he is.
> > For the
> > admin example: visit.setMenuGenerator(new MenuGeneratorAdmin());
> >
> > The problem is that I still get the same menu...
> > The request is done, but for the wrong generator.
> >
> > I have changed the constructor of visit so that he gets new
> > MenuGeneratorAdmin() and then the menu was correct.
> >
> > I don't know what the problem is.
> > Must I give some extra settings to the visit object to store this
> > pointer?
> >
> > Greetz
> >
> > --
> >
> > Koen Segers
> >
> > <ko...@scarlet.be>
> > <http://eddyvite.dyndns.org>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: visit problem

Posted by Todd O'Bryan <to...@mac.com>.
Can you post (the appropriate parts of) your Visit code, and the method 
that gets called when the user logs in? We'll need to see how those 
interact.

Todd

On Jan 29, 2005, at 7:28 AM, Koen Segers wrote:

> Hi,
>
> I have a problem with my visit object.
> In my visit object I store a reference to a MenuGenerator object.
> In visit's constructor I have a new MenuGenerator();
>
> I also have a MenuGeneratorAdmin() which generates the menu if a admin 
> is
> logged in.
> If a user is logged in I reset the pointer to the sort of user he is. 
> For the
> admin example: visit.setMenuGenerator(new MenuGeneratorAdmin());
>
> The problem is that I still get the same menu...
> The request is done, but for the wrong generator.
>
> I have changed the constructor of visit so that he gets new
> MenuGeneratorAdmin() and then the menu was correct.
>
> I don't know what the problem is.
> Must I give some extra settings to the visit object to store this 
> pointer?
>
> Greetz
>
> -- 
>
> Koen Segers
>
> <ko...@scarlet.be>
> <http://eddyvite.dyndns.org>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org