Thursday, November 28, 2013

Rendering a BLOB Attribute in a Template

There are at least two ways for rendering a BLOB attribute. First, and used quite a lot, implies using WebCenter Sites Asset API and scriptlets added in the JSP page. Second method uses a couple of JSP tags and provides a more elegant solution to the problem of rendering BLOB attributes.

In the following example I am using an asset of type DMedia_C with a blob attribute named "file".


Example:


<%--Load the current image (media) asset --%>
<assetset:setasset name="currentImage" type='<%=ics.GetVar("c") %>' id='<%=ics.GetVar("cid") %>'/>

<%--Get the file attribute - the blob that we want to display  --%>
<assetset:getattributevalues name="currentImage" listvarname="fileList" attribute="file" typename="DContent_A"/>

<blobservice:gettablename varname="blobTable"/>
<blobservice:getidcolumn varname="idColumn"/>
<blobservice:geturlcolumn varname="dataColumn"/>

<render:getbloburl outstr="imageUrl"
blobtable='<%=ics.GetVar("blobTable") %>'
blobcol='<%=ics.GetVar("dataColumn") %>'
blobkey='<%=ics.GetVar("idColumn") %>'
blobwhere='<%=ics.GetList("fileList").getValue("value") %>'/>


<img src='<render:stream variable="imageUrl"/>'/>


Don't forget to add the used tags definition to the page:

<%@ taglib prefix="blobservice" uri="futuretense_cs/blobservice.tld" %>

Friday, November 15, 2013

Starting Oracle WebCenter Sites JSK 11.1.1.8.0 on Mac OS X Maverick

I wanted to install the latest version of Oracle WebCenter Sites JSK (11.1.1.8) on my MacBook Pro with OS X Maverick but I ran into a couple of problems. First during the installation process the installer complained twice that the DISPLAY variable is not set but if you ignore the message and click continue, the installation is completed successfully. Second, the JSK was not starting. This is the solution that I found for making Oracle WebCenter Sites JSK work on Mac OS X

The default location for the installation is:

/Users/<myusername>/Library/Oracle/JSK/11.1.1.8.0.app

A double-click on the application will not start it but with slight modifications of run.sh script the Jump Start Kit can be started.

First set the DISPLAY variable. In my case I set it to:

DISPLAY=":0"

Second, set JAVA_HOME. JAVA_HOME is set to:

JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home"

And third, tools.jar. Even with the CurrentJDK set I still get a warning that I am using a JRE instead of a JDK and the jumpstart kit is not starting.



This problem can be solved by examining the log file. In the logfile.out from the jumpstart directory I see that the problem is caused by missing tools.jar from classpath. I know that I have tools.jar in $JAVA_HOME/lib so the simplest solution is adding a classpath entry for tools.jar in the startup script. There are two lines in the run.sh that are starting the JSK. One that is starting it with arguments and the other one without any parameters. So, I added in the classpath:

$JAVA_HOME/lib/tools.jar 

and the run.sh starts JSK now.


Now, this is my solution and I know that is not the best one. If you find other solutions for this problem please let me know!