Announcement Announcement Module
Collapse
No announcement yet.
how to define Boolean in application context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to define Boolean in application context

    Hi all,

    I'm going to configure a parameter map in my application. I have to configure a Boolean type in one of the parameters, I have encoutered ClassCastException if I using following config ..

    Code:
        <bean id="basicReportMulti" class="org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView">
    		<property name="url">
    			<value>/WEB-INF/reports/SQLReport.jrxml</value>
    		</property>        
    		<property name="jdbcDataSource">
                <ref bean="dataSource"/>
    		</property>
    		<property name="exporterParameters">
    			<map>
    				<entry key="net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING">
    					<value>utf-8</value>
    				</entry>
    				<entry key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN">
    					<value>false</value>
    				</entry>                              
    			</map>
    		</property>        
    	</bean>
    I would like to know how can I config a Boolean instead of String under the <map> tag. I have checked the spring.dtd and can't find a way to do this. Any hints ?

    Thanks

  • #2
    Re: how to define Boolean in application context

    Originally posted by commandos
    I would like to know how can I config a Boolean instead of String under the <map> tag. I have checked the spring.dtd and can't find a way to do this. Any hints ?
    I think, this should work (not tested):

    Code:
    <map>
      <entry>
        <key><value type="...">...</value></key>
        <value type="...">...</value>
      </entry>
    </map>
    Using the respective "type" attribute you can specify the concrete element type.

    Regards,
    Andreas

    Comment


    • #3
      Thanks for your quick reply, it works well after change to following !!

      Code:
      ...
      		<property name="exporterParameters">
      			<map>
      				<entry key="net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING">
      					<value>utf-8</value>
      				</entry>
      				<entry key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN">
      					<value type="java.lang.Boolean">false</value>
      				</entry>                
      			</map>
      		</property>   
      ...

      Comment

      Working...
      X