Creating HTML content for SAP NetWeaver Portal
A common request in the portal forums is how to make an iView that contains some straight forward HTML. If KM is being used, then it is possible to create a document in one of the KM folders and point an iView to that document. This is a little difficult to transport through the traditional Development/QA/Production landscape.
Another alternative is to create a portal component for each HTML document, using the NetWeaver Development Studio, which can be complicated to maintain.
The following proposal is based on creating PAR files without the need for building an NDS project for each HTML file. Instead, we create a PAR file through the use of Windows batch scripting.
The prerequistes are that the jar tool be available and that NDS is used once to build our basic Java wrapper. The jar tool is used in the script to build the PAR file.
For each HTML file, we execute the attached script, which creates a par file named as the second parameter based upon the HTML file given as the first parameter. For example, executing:
buildpar test.html fred
would create fred.par with the contents of test.html. It would still be necessary to upload the par file and create any iViews based on the component fred.Page.
The script assumes a folder structure (\temp\buildpar) which is specified in the script file. The folder structure is created the first time the script runs.
The Java wrapper is based on making an NDS portal project called Static that contains a JSP DynPage called Page. Most of the code is generated when we use the wizard. The only piece we really need is the compiled JAR file Staticcode.jar. We move this into a Windows folder shortly…
Here is the code in the portal component:
A copy of the generated jar file is available here until the end of 2006.
The script itself is here. I have called it buildpar.bat.