Subodh Joshi
Subodh Joshi

Reputation: 13492

Include external javascript in JSF page through bean varaible?

Generally we used <h:outputScript /> to refer local scripts and for refering external Java Script we used <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>.

Now my issue is how to refer those java script which dynamically loading through some other url for my case i have to refer this javascript http://150.190.135.41:8700/iportal/jsapi for the time being i am using like this

<script type="text/javascript"
                src="http://150.190.135.41:8700/iportal/jsapi" />

but for me its not a right approach it should be dynamic ,so i added this http://150.190.135.41:8700/iportal/jsapi to a properties file and now in jsf bean i initialize a variable with this url.

Now can any one tell me how to access it into XHTML of JSF Page? This dynamic access needed because ip of iportal would be different for different client.

Upvotes: 1

Views: 661

Answers (1)

Geinmachi
Geinmachi

Reputation: 1251

If you have address in your backing bean then you can do simply

 <script type="text/javascript" src="#{bean.dynamicAddres}" />

Upvotes: 1

Related Questions