Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:00:25+00:00 2026-05-30T14:00:25+00:00

I set a bean’s property to a String object, then when I try to

  • 0

I set a bean’s property to a String object, then when I try to get the class name of the property ,below error is thrown out:

Expected hash. plist[0].javaType evaluated instead to freemarker.template.SimpleScalar on line 7, column 26 in ibatis/macro.ftl.

template code is as below:

<#assign clsName=plist[0].javaType.class.name>

When property javaType is set to a java bean, class name can be properly got. Why is it? I need the property could be given any type, java bean ,non java bean.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:00:26+00:00Added an answer on May 30, 2026 at 2:00 pm

    The root of the issue here is that FreeMarker doesn’t work with Java values/objects directly. The template language has its own simple type-system, and stuff coming from outside is mapped to that through a technique called object-wrapping. (Values that doesn’t come from outside doesn’t even have a wrapped object inside.) That you was still able to get the class of some object is purely accidental… What happens is that the object-wrapping machinery decides that the object should be mapped to the “hash” FreeMarker type, and the hash items will correspond to the JavaBean properties of the objects. The object has a getClass() method, which is (mistakenly) seen as the getter of the “class” property.

    So there’s no universal way of getting the class… among others because sometimes there’s no class to get. You could write a TemplateMethodModelEx that does a good enough effort to do so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Spring proxies set up: <bean id=simpleBean class=org.springframework.aop.framework.ProxyFactoryBean> <property name=target> <ref local=simpleBeanTarget/>
<bean class=org.springframework.web.servlet.handler.SimpleMappingExceptionResolver> <property name=mappedHandlers> <set> <ref bean=exceptionController /> </set> </property> <property name=defaultErrorView value=tiles/content/error />
I understand that a set can be defined as: <bean id=toolbox class=tools.Toolbox> <property name=tools>
I'm trying to set a bean property like this: <bean id=threadImport class=com.foo.bat.util.ThreadImport singleton=false> <property
Hey, what is the best way to set a bean's property with Class value
<bean id=data.emf class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean > <property name=persistenceUnitName value=transactions-optional /> </bean> from what i know by
Is there a way to set a property of a bean in a Spring
I have a managed bean called: @ManagedBean(name=configBean) @SessionScoped public class configBean implements Serializable {
I have method to get list of bean properities like below. How to check
Does it set a flag in a bean ? Does it load special bean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.