# Building Struts Portlets

You can use the Portlet Wizard to generate a portlet based on a Struts Module.

Note: Before you can create a Struts portlet, you must first integrate your existing Struts application into your portal application. See Integrating Struts Applications.

In the WebLogic Workshop IDE, open the Portal application that contains the Struts module. Then create or navigate to the folder that will contain the <portlet-name>.portlet file you are about to generate.

From the IDE top-level menu, select File > New > Portlet. If the project does not yet have the Portal libraries installed, WebLogic Workshop prompts you with the following message:

If you receive this prompt, click the Yes button.

When the portal libraries are installed, the Portlet Wizard prompts you with a series of screens. First, enter a name for the portlet, then click the Create button. The Portlet Wizard displays its Select Portlet Type screen. Select the Struts Portlet option, and click Next.

On the wizard's Struts Module URI screen, specify the folder that will contain the <portlet-name>.portlet file.

On the wizard's Struts Config File screen, identify or browse to the Struts module's XML configuration file. In this example, we had already copied into our Portal application several files that comprise a Struts module and related files. These files are part of a Struts Interop feature sample that is described in the topic Interoperating with Struts and Page Flows.

The following files that are under the <WEBLOGIC_HOME>/samples/workshop/SamplesApp/WebApp/ folder were copied into our Portal application:

/strutsModule/Jsp2.jsp
/WEB-INF/struts-config-strutsModule.xml
/WEB-INF/src/strutsModule/Struts*.java

We specified the struts-config-strutsModule.xml file on the following Portlet Wizard screen, and then clicked the Next button:

On the final screen, Struts Actions, we specified an action for the Struts Portlet:

After clicking the Finish button, the wizard created our <portlet-name>.portlet file in the directory we specified in the Struts Module URI screen.

The Struts portlet can now be brought into the portal application.

Related Topics

Creating Portlets

Customizing Portlets

Adding a Portlet to a Portal