File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access static field present in an inner class in Struts2 Ui tags
 
Similar Threads
Static inner class
Inner Classes
public static field of a public inner class cant be accessed as @FQClassName@Field in struts 2
Using reflection for button listeners, throwing ClassNotFound exception
Why are finals allowed for method-local classes??