내 jsp에서 상수 인터페이스에 액세스하려고하는데 다음 오류가 표시됩니다.jsp에서 자바 인터페이스에 액세스하는 방법
Caused by: tag 'select', field 'list', name 'title':
The requested list key 'Constants.TITLE'
could not be resolved as a collection/array/map/enumeration/iterator type.
Example: people or people.{name} - [unknown location]
내 인터페이스
public interface Constants {
public List<String> TITLE = Arrays.asList("Mr","Mrs","Ms","Miss");
// public String[] TITLE = {"MR","MRs"}; << does not work as well
//public static final String[] TITLE = {"MR","MRs"}; << does not work as well
}
내 JSP로 코드
...
<%@page import="com.myconstants.Constants" %>
<head>
</head>
<body>
<s:form>
<s:select label="title" name="title" list="Constants.TITLE" value=" "/>
</s:form>
....
음, 그러지 마십시오. 클래스에 넣고 정적 인 값으로 표시하는 것이 중요합니다. –
@DaveNewton, 나는 당신에게 내게 모범을 보이지 않을 것인가? –