File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unmatched brace or incomplete EL expression

 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using JSTL in my JSP page:



I am unable to compile this line of code.

The message I see is "Unmatched brace or incomplete EL expression starting at column 0 at line 0".

Can some one help me regarding this?

Thanks,

-Vikas
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Passes JSP validation for me.

Probably something else above this line.

WP
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, if I pass on a string "test" in the value it compiles.

I see the problem occuring only if I use the JSTL function.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure thats the line causing the problem?

And why are you stripping apostrophe's from the last name? :shock: If my last name was O'Brien, I'd be pretty ticked off.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean like:


Paste yours.

WP
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly.

O'Brian in our application is causing a javascript issue. it is breaking because of the '.

To get rid of that issue we are using this approach, for now, as it does not do a lot of harm for this.
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William. Yes you were correct. That was the same code that is not having compilation problems !!
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better not touch O'Sullivan !!!

;)

As I said, I copied your line exactly into a sandbox JSP and it validates fine.

So you are saying this occurs at run-time? When the application is running?

WP
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vikas Gourishetty wrote:
O'Brian in our application is causing a javascript issue. it is breaking because of the '.

So you're stripping it out instead of properly escaping it? Really?
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

Yeah, I need to think on to find a better solution. But this one is causing few problems, so got to live with this right now. :(


William,

Its just the IDE (Jdeveloper) which is complaining. When I change this in the server's deployment folder (Very bad way). It has solved temporarily.


Thanks,

-Vikas
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the IDE complain about:


WP
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William,

I tried your code lol ...



Observed that this problem is occurring with the apostrophe '.

If I remove that It could compile. But It does not solve the purpose.

I thank your effort and time William.

-Vikas


 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe your best approach would be to write a tag library whose purpose is to escape a string for Javascript. Then you wouldn't have to be hard-coding quotes in your EL expression.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17639
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Single and double quotes are 2 of the infamous 5 XML magic characters and therefore can be trouble.

Usually the type of syntax that's in your example works because XML can figure out what you mean from the context, but in cases where it doesn't work, you have to fall back on the entities. The entity for single-quote is "'". Note that final semicolon (;), because it's important.

In any event, trying to do even moderately complex logic in EL is a bugger both to code and debug. Plus, it's a violation of the MVC paradigm that says that the View should display and not attempt to calculate.

So I second Paul's recommendation. Instead of battling EL, you are better off moving the function into a JavaBean.
 
vikas Gourishetty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tim.

I will go with your suggestion. I will handle the ( ' ) at the bean level.


@William:

With this line of code my IDE does not complain:



used

& apos; instead of " \' "



Thank you all.

-Vikas
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic