Hi all,

I have a HtmlUserDialog project and have a page which included some js/css file. Normally we just use the tag like this:

<script src="#{resource['ivy-webcontent:js/xportal-common.js']}" />

And i can see after the page was loaded, the code will be:

<script src="/ivy/faces/javax.faces.resource/js/xportal-common.js?ln=xpertivy-5-webContent">

You can see this <script>, it is always end with param ln=xpertivy-<number>-webContent The <number> here is different. So, for example, when i use some third party js libraries, it have some code to load some others js files by javascript after page loaded, but it can't because i don't have the right <number> of param ln. If anyone here used to use RequireJS, you can understand the situation.

My question is: There is any way to know exactly the parameter ln that ivy will put to the end of <script> ?

Note: Actually i can get this value by using javascript to read other existing <script> and copy from there but i really don't like that way.

Anyone can have me?

asked 06.01.2015 at 13:05

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%

edited 06.01.2015 at 16:02

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958


You can use the #{resource['ivy-webcontent:mypath']} not only in .xhtml files but also in .css and .js files that you load over the jsf resource mechanism. JSF will automatically replace and expand the #{resource[...]} with the right url.

In your example use #{resource[...]} in the xportal-common.js file to reference other files in the webContent folder. JSF will automatically replace the #{resource[...]} with the right url when sending the file to the web browser.

Have a look at the file webContent/layouts/styles/ivy-common.css in the HtmlDialogDemos project to see how #{resource[...]} can be used in a .css file. This also works in .js files.

link

answered 06.01.2015 at 14:29

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.9k202857
accept rate: 74%

edited 06.01.2015 at 14:30

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×58
×6

Asked: 06.01.2015 at 13:05

Seen: 3,348 times

Last updated: 06.01.2015 at 16:02