struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: How to access a map in jsp
Date Thu, 27 Aug 2015 09:26:03 GMT
What are the types of antibioticId and organismTypeId ?
Are they primitive integers/longs?
I would add methods to DTOs to get them as Strings.


I suggest to store the list in a pageScope variable, to make the 
expression better readable.
There should be no dot before the bracket. You wrote "oaMap.[", it should 
be "oaMap["



<s:set var="_oaList" value="oaMap[antibioticId]" />
<s:if test="_oaList.contains(organismTypeId)">....





Regards,
Christoph






Yaragalla Muralidhar <yaragallamurali@gmail.com> schrieb am 27.08.2015 
11:17:06:

> From: Yaragalla Muralidhar <yaragallamurali@gmail.com>
> To: Struts Users Mailing List <user@struts.apache.org>, 
> Date: 27.08.2015 11:17
> Subject: How to access a map in jsp
> 
> Hi,
>  the following is the code in action class
> 
> //_________________________________________________
> private List<AntibioticDto> antibiotics;
> private List<OrganismType> organismTypes;
> private Map<String, List<String>> oaMap;
> @Override
> public String execute() throws Exception {
> try{
> antibiotics=dtService.getAllAntibioticsList();
> organismTypes=dtService.getAllOrganisumTypes();
> oaMap=dtService.getAllSelectedOrganismTypeAntibiotics();
> }catch(Exception e){
> log.error(e.getMessage(), e);
> return "error";
> }
> return SUCCESS;
> }
> //_________________________________________________________
> 
> The following is the code in jsp
> 
> <s:iterator  value="antibiotics" status="status">
> <tr><td><s:property value="antibioticName"/></td>
> <s:iterator  value="organismTypes">
> <td style="width:100px"><input type="checkbox" <s:if 
test="%{oaMap.[((new
> Integer(antibioticId).toString()))].contains((new
> Integer(organismTypeId).toString()))}">checked</s:if> value='<s:property
> value="antibioticId"/>' style="line-height: 35px;" /></td>
> </s:iterator>
> </tr>
> </s:iterator>
> 
> //______________________________________________________________
> 
> i am trying to get the arrylist from the map and trying to check whether 
it
> contains a particular string but this is not working? is this the right 
way
> to do this? If not how to do this?
> 
> *Thanks and Regards,*
> Muralidhar Yaragalla.
> 
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message