jsp WCS-attrdict.jsp

wcs-attrdict.jsp
<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogEntryType[]" var="catalogEntriesForAttributes" expressionBuilder="getCatalogEntryAttrDictDescriptiveAttributesByIDWithPaging">
	<wcf:contextData name="storeId" data="${param.storeId}"/>
	<wcf:param name="catEntryId" value="${catalogEntryID}"/>
	<wcf:param name="dataLanguageIds" value="${WCParam.langId}"/>
	<wcf:param name="accessProfile" value="IBM_Store_CatalogEntryAttributes"/>
</wcf:getData>
	                                                    
<c:forEach var="catentry"items="${catalogEntriesForAttributes}">
	<c:forEach var="attribute"items="${catentry.catalogEntryAttributes.attributes}">
		<c:out value="${attribute.name}"/> : <c:out value="${attribute.value.value}"/>
	</c:forEach>
</c:forEach> 

jsp 查看骨架

查看骨架

view-skeleton.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="template" uri="http://www.jahia.org/tags/templateLib" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="jcr" uri="http://www.jahia.org/tags/jcr" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--@elvariable id="currentNode" type="org.jahia.services.content.JCRNodeWrapper"--%>
<%--@elvariable id="out" type="java.io.PrintWriter"--%>
<%--@elvariable id="script" type="org.jahia.services.render.scripting.Script"--%>
<%--@elvariable id="scriptInfo" type="java.lang.String"--%>
<%--@elvariable id="workspace" type="java.lang.String"--%>
<%--@elvariable id="renderContext" type="org.jahia.services.render.RenderContext"--%>
<%--@elvariable id="currentResource" type="org.jahia.services.render.Resource"--%>
<%--@elvariable id="url" type="org.jahia.services.render.URLGenerator"--%>

jsp JSP中的重定向页面

JSP中的重定向页面

redirect.jsp
<%
String requestURL = request.getRequestURL().toString();
String queryString = request.getQueryString();
String redirectUrl = "http://redirect.to/path";
if (queryString != null) redirectUrl += "?" + queryString;
response.setStatus(301);
response.setHeader( "Location",  redirectUrl);
response.setHeader( "Connection", "close" );
%>

jsp JSP上的SDL SmartTarget促销

JSP上的SDL SmartTarget促销

promotions.jsp
        <smarttarget:query view="home" publication="tcm:0-71-1">
            <smarttarget:facet category="tcm:69-707-4"></smarttarget:facet>
            <smarttarget:promotions maxItems="3" var="promotion" region="homepagepromotions"> <!-- HomepageBanners -->
                <smarttarget:itemTemplate>
                    <smarttarget:promotionalItems>
                        <smarttarget:itemTemplate>
                            <tridion:ComponentPresentation pageURI="tcm:69-6212-64" componentURI="${item.componentUri}" templateURI="${item.templateUri}"/>
                        </smarttarget:itemTemplate>
                    </smarttarget:promotionalItems>
                </smarttarget:itemTemplate>
                <smarttarget:fallbackContent>
                    <tridion:ComponentPresentation pageURI="tcm:69-6212-64" componentURI="tcm:69-2781" templateURI="tcm:69-6322-32"/>
                </smarttarget:fallbackContent>
            </smarttarget:promotions>
        </smarttarget:query>

jsp JSP上的SDL SmartTarget促销

JSP上的SDL SmartTarget促销

promotions.jsp
        <smarttarget:query view="home" publication="tcm:0-71-1">
            <smarttarget:facet category="tcm:69-707-4"></smarttarget:facet>
            <smarttarget:promotions maxItems="3" var="promotion" region="homepagepromotions"> <!-- HomepageBanners -->
                <smarttarget:itemTemplate>
                    <smarttarget:promotionalItems>
                        <smarttarget:itemTemplate>
                            <tridion:ComponentPresentation pageURI="tcm:69-6212-64" componentURI="${item.componentUri}" templateURI="${item.templateUri}"/>
                        </smarttarget:itemTemplate>
                    </smarttarget:promotionalItems>
                </smarttarget:itemTemplate>
                <smarttarget:fallbackContent>
                    <tridion:ComponentPresentation pageURI="tcm:69-6212-64" componentURI="tcm:69-2781" templateURI="tcm:69-6322-32"/>
                </smarttarget:fallbackContent>
            </smarttarget:promotions>
        </smarttarget:query>

jsp ローカルサーバ内のファイルサイズを返すJSPコード.jquery.file.size-extension.jsと组み合わせて使用​​。

ローカルサーバ内のファイルサイズを返すJSPコード.jquery.file.size-extension.jsと组み合わせて使用​​。

getFileSize.jsp
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="WINDOWS-31J" %>
<%
	//ローカル サーバ内のファイル サイズを返す
	String callbackFunc = request.getParameter("callback");
	String DOWNLOAD_FILE_URL = request.getParameter("url");

	try {
			java.net.URL url = new java.net.URL (DOWNLOAD_FILE_URL);
			
			java.lang.String root = "/http_root_dir/";	//URLのルートにあたるサーバのローカル ディレクトリ
			java.lang.String path = url.getPath();			
			java.lang.String path = root + path;
			
			java.io.FileInputStream file = new java.io.FileInputStream(path);
			int file_size = file.available();
			file.close();
			
			out.println(callbackFunc + "({size:\"" + file_size + "\"});");		
		
//		//URLクラスでアクセスする方法だと認証が必用なディレクトリのサイズが取得できない
//		java.net.HttpURLConnection httpURLConnection = (java.net.HttpURLConnection) url . openConnection ();
//		
//		httpURLConnection . setRequestMethod ("HEAD");
//		httpURLConnection . connect ();
//		if( httpURLConnection . getResponseCode () == 200 ) {	
//			out.println(callbackFunc + "({size:\"" + httpURLConnection . getContentLength () + "\"});");		
//		}
//		else {	
//			out.println(callbackFunc + "({size:\"" + -1 + "\"});");		
//		}

	}
	catch (IOException e) {
		out.println(callbackFunc + "({size:\"" + -99 + "\"});");
	}

%>

jsp form.jsp

form.jsp
<c:set var="action" value="saveUpdate.do" />
<c:if test="${empty SqlRotina.idSqlRotina}">
	<c:set var="action" value="saveInsert.do" />
</c:if>


    <form action="${action}" method="post">
        ...
    </form>

jsp SDL SmartTarget 2011 SP2标签演示了SDL SmartTarget启用页面中promtion查询中的变量。这是JSP代码,有类似的

SDL SmartTarget 2011 SP2标签演示了SDL SmartTarget启用页面中promtion查询中的变量。这是JSP代码,ASP .NET有类似的用户控件。 SDL SmartTarget 2011 SP2。

SmartTarget_tag_demo.jsp
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page language="java"%>
<%@ page import="java.net.URI" %>
<%@ page import="com.tridion.ambientdata.claimstore.ClaimStore" %>
<%@ page import="com.tridion.ambientdata.AmbientDataContext" %>
<%@ taglib uri="smarttarget" prefix="smarttarget" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>SmartTarget tag demo</title>
</head>
<body>
<h1>SmartTarget tag demo</h1>
<p>
    <ul>
        <li>Demo of the strucure of SDL SmartTarget tags for promotions. There are more SmartTarget tags in the SmartTarget taglib.</li>
        <li>To make this work with your SmartTarget server update the following:
            <ul>
                <li>publication attribute &lt;smarttarget:query&gt;</li>
                <li>region attribute in &lt;smarttarget:promotions&gt;</li>
                <li>optional: odata URL</li>
                <li>don't forget the settings in smarttarget_conf.xml, look at /Configuration/Fredhopper/Webservice/Server.</li>
            </ul>
        </li>
        <li>To see how multiple promotions are returned, set up multiple promotions...</li>
        <li>Do read the JSP source of this demo!</li>
    </ul>
</p>
<hr/>

	<smarttarget:query view="home" publication="tcm:0-69-1" allowDuplicates="true">
        <blockquote>
            <b>&lt;smarttarget:query&gt;</b> start of the query<br/>
            <smarttarget:promotions region="Sidebar" var="promotion" maxItems="10">
                <blockquote>
                    <b>&lt;smarttarget:promotions&gt;</b> looping through promotions<br/>
                    <smarttarget:itemTemplate>
                        <blockquote>
                            <b>&lt;smarttarget:itemTemplate&gt;</b> item template to apply on each promotion<br/>
                            <blockquote>
                                <b>promotion object properties</b>
                                <ul>
                                    <li>promotion.promotionId: ${promotion.promotionId}<br/></li>
                                    <li>promotion.name: ${promotion.name}<br/></li>
                                    <li>promotion.title: ${promotion.title}<br/></li>
									<li>promotion.region: ${promotion.region}<br/></li>
									<li>promotion.slogan: ${promotion.slogan}<br/></li>
                                </ul>
                                <smarttarget:promotionalItems>
                                    <blockquote>
                                        <b>&lt;smarttarget:promotionalItems&gt;</b> looping through promotional items<br/>
                                        <smarttarget:itemTemplate var="item">
                                            <blockquote>
                                                <b>&lt;smarttarget:itemTemplate&gt;</b> item template to apply on each promotional item<br/>
                                                <blockquote>
                                                        <b>item object properties</b>
                                                        <ul>
                                                            <li>promotionID: ${item.promotionID}</li>
                                                            <li>region: ${item.region}</li>
                                                            <li>componentUri: ${item.componentUri}</li>
                                                            <li>templateURI: ${item.templateUri}</li>
                                                        </ul>
                                                        <ul>
                                                            <li>publication id: ${item.componentUri.publicationId}</li>
                                                            <li>component id: ${item.componentUri.itemId}</li>
                                                            <li>template id: ${item.templateUri.itemId}</li>
                                                        </ul>
                                                        <ul>
                                                            <li>item attributes
                                                                <ul>
                                                                    <c:forEach var="attr" items="${item.getAttributelist()}">
																		<c:choose>
																			<c:when test="${attr.getName()=='componentpresentation'}">
																				<li>
																					${attr.getName()}: <br />
																					<pre>${fn:escapeXml(attr.getValue())}</pre>
																				</li>
																			</c:when>
																			<c:otherwise>
																				<li>${attr.getName()}: ${attr.getValue()}</li>
																			</c:otherwise>
																		</c:choose>
                                                                    </c:forEach>
                                                                </ul>
                                                            </li>
                                                        </ul>
                                                        <ul>
                                                            <li><a href="http://odata.your-staging-server/odata.svc/ComponentPresentations(PublicationId=${item.componentUri.publicationId},ComponentId=${item.componentUri.itemId},TemplateId=${item.templateUri.itemId})/PresentationContent/value" target="_new">Component Presentation on CD webservice</a></li>
                                                        </ul>
                                                </blockquote>
                                            </blockquote>
                                        </smarttarget:itemTemplate>
                                    </blockquote>
                                </smarttarget:promotionalItems>
                            </blockquote>
                        </blockquote>
                    </smarttarget:itemTemplate>
                    <smarttarget:fallbackContent>
                        <blockquote>
                            <b>&lt;smarttarget:fallbackContent&gt;</b> fallback content<br/>
                            This is Fallback content. SmartTaget (Fredhopper query server) did not return any promotions or is not available.<br/>
                        </blockquote>
                    </smarttarget:fallbackContent>
                </blockquote>
            </smarttarget:promotions>
        </blockquote>
    </smarttarget:query>

<hr/>
<%
ClaimStore claimStore = AmbientDataContext.getCurrentClaimStore();
%>
<p>
    <b>Trigger types in claim store</b>
    <b>claim URI</b>: taf:claim:ambientdata:definedtriggertypes<br/>
    <b>value</b>: <%= claimStore != null ? claimStore.get(URI.create("taf:claim:ambientdata:definedtriggertypes")) : "Claimstore not set" %><br/>
</p>
</body>
</html>

jsp SDL SmartTarget 2011 SP2标签演示了SDL SmartTarget启用页面中promtion查询中的变量。这是JSP代码,有类似的

SDL SmartTarget 2011 SP2标签演示了SDL SmartTarget启用页面中promtion查询中的变量。这是JSP代码,ASP .NET有类似的用户控件。 SDL SmartTarget 2011 SP2。

SmartTarget_tag_demo.jsp
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page language="java"%>
<%@ page import="java.net.URI" %>
<%@ page import="com.tridion.ambientdata.claimstore.ClaimStore" %>
<%@ page import="com.tridion.ambientdata.AmbientDataContext" %>
<%@ taglib uri="smarttarget" prefix="smarttarget" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>SmartTarget tag demo</title>
</head>
<body>
<h1>SmartTarget tag demo</h1>
<p>
    <ul>
        <li>Demo of the strucure of SDL SmartTarget tags for promotions. There are more SmartTarget tags in the SmartTarget taglib.</li>
        <li>To make this work with your SmartTarget server update the following:
            <ul>
                <li>publication attribute &lt;smarttarget:query&gt;</li>
                <li>region attribute in &lt;smarttarget:promotions&gt;</li>
                <li>optional: odata URL</li>
                <li>don't forget the settings in smarttarget_conf.xml, look at /Configuration/Fredhopper/Webservice/Server.</li>
            </ul>
        </li>
        <li>To see how multiple promotions are returned, set up multiple promotions...</li>
        <li>Do read the JSP source of this demo!</li>
    </ul>
</p>
<hr/>

	<smarttarget:query view="home" publication="tcm:0-69-1" allowDuplicates="true">
        <blockquote>
            <b>&lt;smarttarget:query&gt;</b> start of the query<br/>
            <smarttarget:promotions region="Sidebar" var="promotion" maxItems="10">
                <blockquote>
                    <b>&lt;smarttarget:promotions&gt;</b> looping through promotions<br/>
                    <smarttarget:itemTemplate>
                        <blockquote>
                            <b>&lt;smarttarget:itemTemplate&gt;</b> item template to apply on each promotion<br/>
                            <blockquote>
                                <b>promotion object properties</b>
                                <ul>
                                    <li>promotion.promotionId: ${promotion.promotionId}<br/></li>
                                    <li>promotion.name: ${promotion.name}<br/></li>
                                    <li>promotion.title: ${promotion.title}<br/></li>
									<li>promotion.region: ${promotion.region}<br/></li>
									<li>promotion.slogan: ${promotion.slogan}<br/></li>
                                </ul>
                                <smarttarget:promotionalItems>
                                    <blockquote>
                                        <b>&lt;smarttarget:promotionalItems&gt;</b> looping through promotional items<br/>
                                        <smarttarget:itemTemplate var="item">
                                            <blockquote>
                                                <b>&lt;smarttarget:itemTemplate&gt;</b> item template to apply on each promotional item<br/>
                                                <blockquote>
                                                        <b>item object properties</b>
                                                        <ul>
                                                            <li>promotionID: ${item.promotionID}</li>
                                                            <li>region: ${item.region}</li>
                                                            <li>componentUri: ${item.componentUri}</li>
                                                            <li>templateURI: ${item.templateUri}</li>
                                                        </ul>
                                                        <ul>
                                                            <li>publication id: ${item.componentUri.publicationId}</li>
                                                            <li>component id: ${item.componentUri.itemId}</li>
                                                            <li>template id: ${item.templateUri.itemId}</li>
                                                        </ul>
                                                        <ul>
                                                            <li>item attributes
                                                                <ul>
                                                                    <c:forEach var="attr" items="${item.getAttributelist()}">
																		<c:choose>
																			<c:when test="${attr.getName()=='componentpresentation'}">
																				<li>
																					${attr.getName()}: <br />
																					<pre>${fn:escapeXml(attr.getValue())}</pre>
																				</li>
																			</c:when>
																			<c:otherwise>
																				<li>${attr.getName()}: ${attr.getValue()}</li>
																			</c:otherwise>
																		</c:choose>
                                                                    </c:forEach>
                                                                </ul>
                                                            </li>
                                                        </ul>
                                                        <ul>
                                                            <li><a href="http://odata.your-staging-server/odata.svc/ComponentPresentations(PublicationId=${item.componentUri.publicationId},ComponentId=${item.componentUri.itemId},TemplateId=${item.templateUri.itemId})/PresentationContent/value" target="_new">Component Presentation on CD webservice</a></li>
                                                        </ul>
                                                </blockquote>
                                            </blockquote>
                                        </smarttarget:itemTemplate>
                                    </blockquote>
                                </smarttarget:promotionalItems>
                            </blockquote>
                        </blockquote>
                    </smarttarget:itemTemplate>
                    <smarttarget:fallbackContent>
                        <blockquote>
                            <b>&lt;smarttarget:fallbackContent&gt;</b> fallback content<br/>
                            This is Fallback content. SmartTaget (Fredhopper query server) did not return any promotions or is not available.<br/>
                        </blockquote>
                    </smarttarget:fallbackContent>
                </blockquote>
            </smarttarget:promotions>
        </blockquote>
    </smarttarget:query>

<hr/>
<%
ClaimStore claimStore = AmbientDataContext.getCurrentClaimStore();
%>
<p>
    <b>Trigger types in claim store</b>
    <b>claim URI</b>: taf:claim:ambientdata:definedtriggertypes<br/>
    <b>value</b>: <%= claimStore != null ? claimStore.get(URI.create("taf:claim:ambientdata:definedtriggertypes")) : "Claimstore not set" %><br/>
</p>
</body>
</html>