I am using Struts2
and I am trying to populate the drop down using <s:select>
tag but for some reason I don't see anything in the drop down. In the back end the list wsAuditConfig
is getting populated with the values but it is not showing up in the drop down.
Action
private List<String> wsAuditConfig;
public void prepare() throws Exception {
AppConfigClient appConfigClient = ( AppConfigClient ) AppContext.getBean( Constants.SPRING_BEAN_CMS_APP_CONFIG_CLIENT );
String appCode = ( String ) System.getProperty( Constants.SPRING_BEAN_EIS_APP_CODE );
List<AppConfig> list = new ArrayList<>();
wsAuditConfig = new ArrayList<>();
GetAppConfigServiceRequest request = appConfigClient.getGetAppConfigServiceRequest();
request.setParameters( appConfigClient.getAppConfigRequestParameters( appCode, null ) );
request.setAccepts( ContentType.JSON );
GetAppConfigServiceResponse response = appConfigClient.get( request );
if( response != null && response.getEntity() != null ) {
list = response.getEntity().getConfig();
for( AppConfig appConfig : list ) {
if( appConfig.getConfigCode().equals( Constants.APP_WS_AUDIT_CONFIG ) ) {
wsAuditConfig.add( appConfig.getKeyName1() );
}
}
}
this.records = new ArrayList<>();
}
JSP
<s:form action="viewWSAuditXml" namespace="/eismain/cmswsaudit/view" name="wsAudit">
<s:select name="wsName" headerValue="" headerKey="" list="wsAuditConfig" listKey="wsName" listValue="wsName" key="ws.audit.view.select" onchange="wsAudit.submit();" cssStyle="min-width: 220px;"/>
</s:form>