• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Option Collection using MAP

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am trying to implement dropdown using MAP data and getting error

Here is the code, Can you please help? is it possible to use value & key?

Part of JSP



<%@ page import="java.util.Collections" %>
<%@ page import="java.util.HashMap" %>

<html:html>

<%
HashMap params = new HashMap();
params.put("param1", "param1Value");
params.put("param2","param2Value");
pageContext.setAttribute("linkParams", params);
%>


<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<html:form method="get" action="listType" >

<html:options collection="linkParams" property="params" value="value" label="key"/> </html:select>

</html:form>
</html:html>
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags.

I am trying to implement dropdown using MAP data and getting error



What's the error?
 
Vis Deo
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


error is given below.
I want to know syntax to use Map for options collection
if this syntax is correct?
<html:options collection="linkParams" property="params" label="value" value="key"/>

As the Map is generalized and will not have any specific getter / setter but through getKey and getValue?
Is using MAp is supported at all?

Map of specific value object that has getter setter may be easy to code bu my situation is addressing it for generalized codes table
that has code and description


ERROR! Failed to process your request.
JSPG0227E: Exception caught while translating /patient_setAneurysmType.jsp: /patient_setAneurysmType.jsp(176,6) --> JSPG0123E: Unable to locate tag attribute info for tag attribute label.


 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you read the error message?

The server wrote:Unable to locate tag attribute info for tag attribute label.


<html:options> documentation
 
Vis Deo
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the syntax

<html:options collection="MAPTYPES" property="key" labelProperty="value" />

and in Action form set the MAP to session like


session.setAttribute("MAPTYPES",MyDao.getMyTypeMap());

Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic