alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (WelcomePortlet.java)

This example Spring Framework source code file (WelcomePortlet.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

enumeration, genericportlet, genericportlet, io, ioexception, ioexception, jsr-168, name, name, parameters:, portal, printwriter, printwriter, renderresponse, string, util

The Spring Framework WelcomePortlet.java source code

package org.springframework.samples.petportal.portlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.WindowState;

/**
 * An example of a pre-existing JSR-168 compliant portlet which is used
 * in the demonstration of Spring's PortletWrappingController. View the
 * bean definitions in welcome-portlet.xml for details.
 * 
 * @author John A. Lewis
 * @author Mark Fisher
 * @author Juergen Hoeller
 */
public class WelcomePortlet extends GenericPortlet {

	public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out.println("<h1>Welcome to the Pet Portal!");
		if(request.getWindowState().equals(WindowState.MAXIMIZED)) {
			out.println("<p>This portlet delegates to an existing JSR-168 portlet via a HandlerAdapter

"); out.println("<p>(see WEB-INF/context/welcome-context.xml for the details).

"); out.println("<p>Portlet Name: " + this.getPortletName() + "

"); out.println("<p>Init Parameters:

    "); for (Enumeration e = this.getInitParameterNames(); e.hasMoreElements();) { String name = (String)e.nextElement(); out.println("<li>" + name + " = " + this.getInitParameter(name) + ""); } out.println("</ul>"); out.println("<p>Your Locale: " + request.getLocale().toString() + "

    "); } } }

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework WelcomePortlet.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.