Writes a link to a file. Supports optional desktop integration mode.

If OpenFile is enabled, the connection is from localhost, and not exporting, creates a file:///… URL to the file so that it may be opened locally by the browser. Will additionally open from the server-side when JavaScript enabled.

If there is no body, will write the filename followed by the file size.

OpenFile must be explicitly enabled by setting the com.semanticcms.openfile.servlet.OpenFile.enabled context parameter to true.

For security, OpenFile may only be called from localhost. However, be careful when behind a proxy, as external proxied requests can appear to come from localhost.

OpenFile may be enabled for development but disabled in production by selectively including the semanticcms-openfile-servlet dependency by profile. By not including the dependency in production builds, the code is not simply disabled, but is not even included in production.

The onclick AJAX file opening is disabled when the documents are exporting, as set by the X-com-semanticcms-core-exporting: true header.

Tag Information

Tag Class: com.semanticcms.file.taglib.FileTag
TagExtraInfo Class: None
Body Content: scriptless
Display Name: None
Dynamic Attributes: true


Name Required Evaluation Type Description
id No Deferred-Value String

The id used in URL anchors. If not provided, is generated from the label. Must be unique per page. Ids generated from labels will be unique, but may change as page structure changes.

book No Deferred-Value String

The book containing the file. Defaults to the book of the current JSP file.

path Yes Deferred-Value String

The page-relative path to the file.

hidden No Runtime boolean

When true, the file is displayed on the page but not added to the list of files on the page. Defaults to false.


No Variables Defined.