struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Dowson <jldow...@gmail.com>
Subject Weird problem with struts tags
Date Fri, 02 Jul 2010 09:13:33 GMT
I have an action class that has the following method

   public WebUser getAuthenticatedUser() ....

The WebUser class has the following methods:

  public Employee getEmployee()....
  public boolean isEmployee()...

and the WebUser class has the following method

 public boolean isWorkgroupEnable()....

In a jsp I use the following tag:
	<s:if test="AuthenticatedUser.Employee.workgroupEnable">

Will this call the getEmployee() method or the isEmployee() method?

I ask because this code used to work but is now causing problems. The weird thing is that
the behaviour seems to be different depending upon the environment.
I have inserted the following debug statements to try and find out what is happening:

console.log('Authenticated user: <s:property value="AuthenticatedUser.displayName"/>');
console.log('Employee is: <s:property value="AuthenticatedUser.employee"/>');  // lower
case e
console.log('Employee is: <s:property value="AuthenticatedUser.Employee"/>'); // upper
case E
console.log('Employee name is: <s:property value="AuthenticatedUser.Employee.name"/>');
console.log('Employee name is: <s:property value="AuthenticatedUser.employee.name"/>');
console.log('**Code uses: Is workgroups enabled: <s:property value="AuthenticatedUser.Employee.workgroupEnable"/>');

On my dev environment (Mac OS X), this produces the following output:
	Authenticated user: Insurer Admin			-- as expected
	Employee is: true							-- isEmployee() method called
	Employee is: true							-- isEmployee() method called
	Employee name is:				                -- isEmployee() method called
	Employee name is:					        -- isEmployee() method called
	**Code uses: Is workgroups enabled: 
which indicates that the isEmployee() method is being called.
However, the exact same war file dropped into our integration server running Gnu Linux gives
the following:
	Authenticated user: Insurer Admin				-- as expected
	Employee is: true								-- isEmployee() method called
	Employee is: idas.chox.core.model.Insurer@3	-- getEmployee() method called
	Employee name is: RSD						-- getEmployee() method called
	Employee name is:							-- isEmployee() method called
	**Code uses: Is workgroups enabled: true
which indicates that the isEmployee method is called when a lower case letter is used, and
the getEmployee() method when the uppercase letter is used.

Does anyone have any idea what is causing this different behaviour for the same code?

This has now been driving me crazy for several days, so any help much appreciated. Up until
a few days ago, the code was also working as expected on my local (mac os x) environment.

John.


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


Mime
View raw message