I figured it out.

In myClass, I have an enum listing the different state values. My
AVAILABLE_STATES variable was placed inside the curly braces for the enum.
This inadvertently placed the AVAILABLE_STATES variable inside the enum and
caused Struts 2 to throw an error message.


DavidZaz wrote:
> 
> I'm trying to access a static constant from a JSP page in Struts 2.0.14,
> but it is not working.
> 
> My JSP page:
> 
> <s:select list="@org.my.company.mycl...@available_states" />
> 
> Java code:
> 
> package org.my.company;
> 
> import java.util.ArrayList;
> import java.util.List;
> 
> public Class myClass {
> 
> public static final List<String> AVAILABLE_STATES = getStates();
> 
> public static final List<String> getStates() {
> List<String> states = new ArrayList<String>();
> states.add("New York");
> return states;
> }
> 
> When I try to access my jsp page, I receive the following error message:
> 
> Caused by: tag 'select', field 'list': The requested list key
> '@org.my.company.mycl...@available_states' could not be resolved as a
> collection/array/map/enumeration/iterator type. Example: people or
> people.{name} - [unknown location]
> 
> Does anyone have any suggestion about what needs to be changed?
> 
> Thanks!
> 

-- 
View this message in context: 
http://old.nabble.com/Accessing-Static-Constants-from-JSP-in-Struts-2.0.14-tp27018870p27019067.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to