客户端
|
Portal
服务器
|
Portlet
容器
|
Action
|
Jsp
|
request
|
setAttribute
|
getAttribute
|
.xreg文件
|
<?xml version="1.0" encoding="UTF-8"?>
<registry>
<portlet-entry name="AppDemo" hidden="false"
type="instance" parent="JSP" application="false">
<meta-info>
<title>
简单应用</title>
<description>
应用portlet示例</description>
</meta-info>
<classname>org.apache.jetspeed.portal.portlets.JspPortlet</classname>
<parameter name="template" value="appdemo/appDemo.jsp"
hidden="true" cachedOnName="true" cachedOnValue="true"/>
<parameter name="action" value="appdemo.AppDemoAction"
hidden="true" cachedOnName="true" cachedOnValue="true"/>
<media-type ref="html"/>
<url cachedOnURL="true"/>
<category group="Jetspeed">测试
</category>
</portlet-entry>
<portlet-entry>
……
</portlet-entry>
</registry>
|
<%@ page contentType="text/html; charset=GB18030" %>
<%@ taglib uri="http://www.aerostrongsoft.com.cn/asop/portal/tags-template" prefix="template" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
今天是:
<fmt:formatDate dateStyle="FULL" value="${today}"><br>
<form action="
<template:dynamicUri/>" method="post">
<input type="hidden" name="js_peid" value="<c:out value='${js_peid}'>"/>
您的姓名:
<input type="text" name="user_name"/>
<input type="submit" name="
eventSubmit_doWelcome" value="提交
"/>
</form>
|
package com.aerostrong.asop.portal.portlet.actions.appdemo;
import org.apache.jetspeed.modules.actions.portlets.JspPortletAction;
import org.apache.jetspeed.portal.Portlet;
import org.apache.turbine.util.RunData;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class AppDemoAction
extends JspPortletAction {
private static Log log = LogFactory.getLog(AppDemoAction.class);
protected void buildNormalContext(Portlet portlet, RunData runData) {
log.trace("in");
runData.getRequest().setAttribute("today", new java.util.Date());
}
public void doWelcome(RunData runData, Portlet portlet) {
log.trace("in");
String name = runData.getParameters().getString("user_name");
runData.getRequest().setAttribute("userName", name);
setTemplate(runData, "appdemo/appDemoWelcome.jsp");
}
}
|
<%@ page contentType="text/html;charset=GB18030" %>
<%@ taglib uri="
http://www.aerostrongsoft.com.cn/asop/portal/tags-template" prefix="template" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
欢迎您,
<c:out value="${userName}"/><br>
<a href="<template:dynamicUri/>
?js_peid=<c:out value='${js_peid}'/>">返回
</a>
|
services.JspService.templates =/WEB-INF/templates-asop/jsp
module.packages=com.aerostrong.asop.portal.portlet
|
services.TemplateLocator.templateRoot=/WEB-INF/templates-asop
|