File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Prathima Gajibiji
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic