4

It's possible to include javascript via outputScript tag from jsp which generate is? (contentType=application/javascript)

Or maybe there is another way to achieve localized javascript in facelets (best practice)?

1
  • my question is about how to do this by outputScript tag in myfaces, given: jsf which generates javascript like in replies from stackoverflow.com/questions/14575128/… goal: output it by myfaces outputScript tag Commented Nov 23, 2013 at 12:49

1 Answer 1

3

The <h:outputScript> doesn't support JSP/Facelets files, but only real plain .js files.

Your best bet is using "plain vanilla" <script> element.

<script src="#{request.contextPath}/resources/script.jsp"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

thanks, it's possible to include it inside head from some composition define tag?
Certainly. Just put a <ui:insert name="head" /> in the desired location of <h:head> of master template and then declare the above script inside <ui:define name="head"> of template client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.