March 24th, 2011
6:41 pm
Escaping quotes and other characters in JSF Expression Language

Posted under JSF
Tags , , ,

Some quick points on this are as follows:-

  • If you are using double quotes at the out level e.g. for HTML attributes, use single quotes inside the EL expressions
  • If you need quotes inside the EL, escape them with backslash as per normal Java standards

An example of an attribute containing EL with escaped quotes follows (note that the blog post may mess up the quote appearance slightly) :-

onstart="return #{empty cc.attrs.onstart ? ‘true’ : el:format1(cc.attrs.onstart, el:concat3(‘\”, component.clientId, ‘\”))}"

No Comments »

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.