1

I have a WebCenter Sites installation. Separately, I have site.js and site.css files. How can I make a WebCenter Sites template use these two files? Where do i put those files so they can be consumed?

What I've done so far is set up a simple HTTP server outside of WebCenter Sites and used <link> and <script> tags to point to those files on the external server. This does indeed work, but I prefer having the files served from the sites application.

I see sites exposes a CSS type asset, but it seems to be tied to their widget framework. I was thinking to just make an empty widget with CSS, then I could reference the widget/asset in the <link href=. Again there aren't many examples of this online.

Can anyone give me some ideas on how to serve files from within WebCenter Sites?

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
Hcabnettek
  • 12,678
  • 38
  • 124
  • 190
  • Down vote? For what? Please explain? Is my question not formatted correctly? Or is it the chosen technology? – Hcabnettek Jul 09 '15 at 21:34
  • I don't know what the downvote and close vote were thinking specifically, but your question being in one large paragraph doesn't make a great first impression. I broke them up and did a little copyediting. I also removed the parts about “best practices” and begging for help because they may be taken negatively and aren't really part of your core question. Hope this helps get you an answer! – Kevin Reid Jul 09 '15 at 21:57
  • Thank you kindly Kevin. I appreciate your edits! – Hcabnettek Jul 09 '15 at 22:08

2 Answers2

2

There are alternatives to storing files directly in the webapp, such as using a custom basic assettype to contain the files, and then delivering them via blobserver (or just rendering inline). The advantage to this is that you are managing assets to keep environments in sync, rather than updating the webapp & redeploying.

1

The path needs to be relative to the web application context. There are probably better ways to reference it in Sites, but the lowest-common denominator approach that will work for all J2EE web applications is to use pageContext.request.contextPath, so the link would look like:

href="${pageContext.request.contextPath}/src/stylesheets/css/styles.css"

So if this were used with a JSK, the src folder would be under [JSK_HOME]\App_Server\apache-tomcat-7.0.42\Sites\webapps\cs