国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
Hello World Portlet Tutorial
Find this tutorial in: /home/caucho/webapps/resin-3.0/portlet/tutorial/basic-hello
Try the Tutorial
The Hello, World tutorial shows the most basic portlet and its configuration in a simple browser page.

  1. Files in this tutorial
  2. Portlet
  3. PortletServlet
  4. Compatibility

Portlets form a design pattern where a Portal servlet combines one or more component Portlets into a web page. Because the portlets are written as components, they can be cleanly written and tested. Applications which currently use many servlet includes might be more cleanly written as portlet applications.

The Portal part of the pattern is a servlet which manages the portlets. In this example, the servlet is a simple "invoker" which calls a single portlet to render the page. Many applications will write their own Portal servlets, using Resin‘s generic portal library to handle the Portlet API.

The "Hello, world" portlet requires the following configuration:

  • The HelloWorldPortlet.java code
  • web.xml configuration of the Portlet servlet

Files in this tutorial

WEB-INF/classes/example/HelloWorldPortlet.java Simple portlet
WEB-INF/web.xml web-app configuration

Portlet

A Portlet is a class that implements class javax.portlet.Portlet . It is similar to a servlet.

The HelloWorldPortlet in this tutorial sends a Hello, World message to the browser.

The response to the browser is generated by the render() method.

example.HelloWorldPortlet
See it in: WEB-INF/classes/example/HelloWorldPortlet.java
package example;import java.io.PrintWriter;import java.io.IOException;import javax.portlet.GenericPortlet;import javax.portlet.RenderRequest;import javax.portlet.RenderResponse;import javax.portlet.PortletException;public class HelloWorldPortlet extends GenericPortlet {  /**   * The portlet‘s main view prints "Hello, World"   */  public void doView(RenderRequest request, RenderResponse response)    throws PortletException, IOException  {    PrintWriter out = response.getWriter();    out.println("Hello, World");  }}

PortletServlet

class com.caucho.portal.generic.PortletServlet is a servlet that dispatches to a portlet. In this way, portlets can be used as drop-in replacements for servlets.

WEB-INF/web.xml
See it in: WEB-INF/web.xml
<web-app xmlns="http://caucho.com/ns/resin"         xmlns:resin="http://caucho.com/ns/resin/core">  <servlet servlet-name="hello"            servlet-class="com.caucho.portal.generic.PortletServlet">    <init>      <portlet resin:type="example.HelloWorldPortlet"/>    </init>  </servlet>  <servlet-mapping url-pattern="/hello" servlet-name="hello"/></web-app>

Portlets work without modification in all portal products. The PortletServlet is a simple way to get a portlet going, and provides a convenient way to replace servlets with portlets.

This approach is valuable for developers that wish to take advantage of the well defined pattern that portlets provide, without necessarily needing the more complete set of features such as sophisticated rendering and management of multiple portlets per page that a more complete portal provides.

Compatibility

The tutorial takes advantage of Resin‘s dependency injection features. The PortletServlet also supports the use of init-param‘s if dependency injection is not available.

init-param WEB-INF/web.xml
<web-app>  <servlet>    <servlet-name>hello</servlet-name>    <servlet-class>com.caucho.portal.generic.PortletServlet</servlet-class>    <init-param>      <param-name>portlet-class</param-name>      <param-value>example.HelloWorldPortlet</param-value>    </init-param>  </servlet>  <servlet-mapping>    <url-pattern>/hello</url-pattern>    <servlet-name>hello</servlet-name>  </servlet-mapping></web-app>

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
liferay二次開(kāi)發(fā)指南
關(guān)于Liferay的配置文件 —— 基于Struts開(kāi)發(fā)Portlet
Apache 門(mén)戶(hù)項(xiàng)目組介紹
hessian教程
Freemarker在web.xml配置說(shuō)明-kenshinlk -JavaEye技術(shù)社區(qū)
Java Portlet Tools:將 Java Web 應(yīng)用轉(zhuǎn)換為適應(yīng)性 Portlet
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服