aspose file tools*
The moose likes Struts and the fly likes How to access static field present in an inner class in Struts2 Ui tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to access static field present in an inner class in Struts2 Ui tags" Watch "How to access static field present in an inner class in Struts2 Ui tags" New topic
Author

How to access static field present in an inner class in Struts2 Ui tags

Prathima Gajibiji
Greenhorn

Joined: Oct 06, 2007
Posts: 6
Hi,

I am facing an issue accessing a static field present in an inner class.
For example:

package com.hcl.amd.utils;
public class STUtil{
public class InventoryConstants{
public static final String PROD_CHANNEL_US = "1";
public static final String PROD_CHANNEL_CAN = "2";
public static final String PROD_CHANNEL_OTHERS = "2";
.
.
.
}
public class ShippingConstants{
public static final String SHIP_RUSH_DELIVERY_US = "1";
public static final String SHIP_RUSH_DELIVERY_CAN = "2";
public static final String SHIP_RUSH_DELIVERY_OTHERS = "3";
.
.
.
}
.
.
.
}

In my Jsp, I want to check if rush delivery is chosen by customer

I tried:
<s:if test="%{#request[@com.hcl.amd.STConstants@SHIP_INFO].deliveryOption == @com.hcl.amd.utils.STUtil.ShippingConstants@SHIP_RUSH_DELIVERY_US}">

There is an object of type ShipInfo in request scope which has the field "deliveryOption". I have even printed the #request[@com.hcl.amd.STConstants@SHIP_INFO].deliveryOption in my debug statements to see what value is coming and the value = 1. So that confirms that the ShipInfi bean exists in request scope. So left part of my if condition is correct and I doubt the right side has an issue. I think it might be looking for ShippingConstants class in STUtil package or something like that.

I tried several options but none of them worked.

Can someone help me in this regard?

Cheers,
Prathima

 
Don't get me started about those stupid light bulbs.
 
subject: How to access static field present in an inner class in Struts2 Ui tags