2

I am new to JSF 1.2, I am trying to output some text into my javascript call like so

something(<t:outputText value="#{bean.val}"/>) 

but instead of getting plain text output, this is all being wrapped in a span. How do i get rid of the span?

2 Answers 2

5

I am not sure about t:outputText, but an h:outputText without any other attribute than value should not render any HTML element.

something(<h:outputText value="#{bean.val}"/>); 

If you're using id, styleClass or something like that, then it will indeed render a <span> since those attributes has to get somewhere anyway.

If you're using Facelets as view technology instead of legacy JSP, then you could also just use EL in template text like follows:

something(#{bean.val})
Sign up to request clarification or add additional context in comments.

Comments

1

what about simply putting:

something("#{bean.val}"); 

2 Comments

that's strange. I'm almost sure it works fine in JSF 1.2 as well. (+1 for which)
Correction: only on Facelets. JSP doesn't support that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.