public class CmsJspTagLink
extends javax.servlet.jsp.tagext.BodyTagSupport
<cms:link>[filename]</cms:link>
tag to add OpenCms managed links to a JSP page, required for link
management and the static
export to work properly.构造器和说明 |
---|
CmsJspTagLink() |
限定符和类型 | 方法和说明 |
---|---|
int |
doEndTag() |
java.lang.String |
getBaseUri()
Returns the base URI used to create the link target.
|
static java.lang.String |
linkTagAction(java.lang.String target,
javax.servlet.ServletRequest req)
Returns a link to a file in the OpenCms VFS
that has been adjusted according to the web application path and the
OpenCms static export rules.
|
static java.lang.String |
linkTagAction(java.lang.String target,
javax.servlet.ServletRequest req,
java.lang.String baseUri)
Returns a link to a file in the OpenCms VFS
that has been adjusted according to the web application path and the
OpenCms static export rules.
|
void |
release() |
void |
setBaseUri(java.lang.String baseUri)
Sets the base URI used to create the link target.
|
doAfterBody, doInitBody, doStartTag, getBodyContent, getPreviousOut, setBodyContent
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
public static java.lang.String linkTagAction(java.lang.String target, javax.servlet.ServletRequest req)
The current OpenCms user context URI will be used as source of the link.
Since OpenCms version 7.0.2, you can also use this method in case you are not sure if the link is internal or external, asCmsLinkManager.substituteLinkForUnknownTarget(org.opencms.file.CmsObject, String)
is used to calculate the link target.Relative links are converted to absolute links, using the current element URI as base.
target
- the link that should be calculated, can be relative or absolutereq
- the current requestCmsLinkManager.substituteLinkForUnknownTarget(org.opencms.file.CmsObject, String)
public static java.lang.String linkTagAction(java.lang.String target, javax.servlet.ServletRequest req, java.lang.String baseUri)
If the baseUri
parameter is provided, this will be treated as the source of the link,
if this is null
then the current OpenCms user context URI will be used as source.
target
- the link that should be calculated, can be relative or absolutereq
- the current requestbaseUri
- the base URI for the link sourcelinkTagAction(String, ServletRequest)
public int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
在接口中 javax.servlet.jsp.tagext.Tag
doEndTag
在类中 javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- in case something goes wrongTag.doEndTag()
public java.lang.String getBaseUri()
public void release()
release
在接口中 javax.servlet.jsp.tagext.Tag
release
在类中 javax.servlet.jsp.tagext.BodyTagSupport
Tag.release()
public void setBaseUri(java.lang.String baseUri)
baseUri
- the base URI used to create the link target