473,511 Members | 15,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

freeMarker issue: Encountered "{" at line 36, column 38

momotaro
357 Contributor
am trying to generate some html files using Templates with freeMarker but I stumbled on this error at this line:
Expand|Select|Wrap|Line Numbers
  1. instance="#{${entityName}Controller.selectedInstance}"
Encountered "{" at line 36, column 38 in \Templates\templateComp.xhtml.
Was expecting one of:
";" ...
"}" ...
"." ...
"[" ...
"(" ...
"?" ...
"!" ...
<TERMINATING_EXCLAM> ...
"??" ...
"+" ...
"-" ...
"*" ...
"/" ...
"%" ...
"!=" ...
"=" ...
"==" ...
">=" ...
<ESCAPED_GTE> ...
">" ...
<ESCAPED_GT> ...
<LESS_THAN_EQUALS> ...
<LESS_THAN> ...
".." ...
<AND> ...
<OR> ...

thank's in advance.
Aug 15 '11 #1
6 6071
Oralloy
988 Recognized Expert Contributor
momotaro,

You need to escape the sharp character ('#') in the string. I think you simply need to prefix it with a back-stroke ('\') or a dollar sign ('$'), I don't remember which.

Luck!
Oralloy
Aug 15 '11 #2
momotaro
357 Contributor
In fact this is how it should be done:
Expand|Select|Wrap|Line Numbers
  1. instance="#\{${entityName}Controller.newInstance}"
but the output will be then:
instance="#\{EmployeeController.newInstance}"
which is not correct since I don't need the extra backslash there.Any ideas ?
thank's in advance.
Aug 15 '11 #3
Oralloy
988 Recognized Expert Contributor
momotaro,

Did you try
Expand|Select|Wrap|Line Numbers
  1. instance="\#{${entityName}Controller.newInstance}"
Otherwise, it may be time get ugly and build the string the hard way....
either:
Expand|Select|Wrap|Line Numbers
  1. instance="\u0022{${entityName}Controller.newInstance}"
or:
Expand|Select|Wrap|Line Numbers
  1. instance="#set($sharp='#')$sharp{${entityName}Controller.newInstance}"
Luck,
Oralloy

I'm familiar with Velocity, which has similar problems.
Aug 15 '11 #4
momotaro
357 Contributor
first one \#: gives errors
second one prints that: instance="\u0022{EmployeeByDepartmentController.ne wInstance}"
third one prints that:
instance="#set($sharp='#')$sharp{EmployeeByDepartm entController.newInstance}"

PS: freemarker consider everything as static to be printed unless it is an interpolation...So unless I come up with an idea to change the interpolation and make it user defined , which is I think impossible, it will not work.
thank's anyway.
Aug 15 '11 #5
momotaro
357 Contributor
I don't wanna hard code it :D
Aug 15 '11 #6
Oralloy
988 Recognized Expert Contributor
momotaro,

Unfortunately this has gone beyond my ability. I use velocity, and I've had similar problems in the past.

If you can inject a Character object into the context, then you can insert the # by doing using reference, as in my third example.

Aren't magic symbols a nusiance?

My apologies.
Oralloy.
Aug 15 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2072
by: Tom Loredo | last post by:
Hi folks- I'm about to move from a Solaris 8/SPARC environment to a Dell running RedHat 9. Are there any issues I need to be aware of in bringing my Python code over (mostly scientific...
28
2765
by: grahamd | last post by:
Who are the appropriate people to report security problems to in respect of a module included with the Python distribution? I don't feel it appropriate to be reporting it on general mailing lists.
5
4672
by: sandy | last post by:
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to...
2
2267
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
1
1657
by: Aliandro | last post by:
Hi Does any one know where I can find information regarding any issues with SQL and IIS being run under windows XP SP2? as I am in the process of programmning in Dot net and neet some way of...
7
1836
by: David Laub | last post by:
I have stumbled across various Netscape issues, none of which appear to be solvable by tweaking the clientTarget or targetSchema properties. At this point, I'm not even interested in "solving"...
2
3035
by: G2 | last post by:
Hi We are dealing with significant browser compatibility issues with Netscape 5.x+ browsers and Mac IE. I am sure most web developers have faced similar issues in the past. Can anyone give me their...
1
1944
by: GaryDean | last post by:
We have been developing all of our .net applications on 32 bit windows using 32 bit SQL Server. We are being asked to now deploy to servers running 64bit windows and 64bit SQL Server. Are there...
3
1636
by: eschneider | last post by:
Just some common issues with WS: Using custom objects: When objects change, seems you are always fixing some issue. Update references, which sometimes does not work. Deployment: Weird errors...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.