Create Struts Portlet in Weblogic Portal 10.3

Perquisites

  • Installation of Weblogic Portal, including the eclipse workshop.
  • Create a workspace and EAR Portal, and add a Portal Web project to it.

Development Steps

  1. Create a struts-config XML file, naming it with the convention : struts-auto-config-<ModuleName>.xml where “ModuleName” is the struts module name to be referred to in the portlet definition. (Example : struts-auto-config-helloWorld.xml).
  2. Add the struts-config XML file to the entry in web.xml.
    <init-param>
    <param-name>config</param-name>
    <param-value>/_pageflow/struts-config.xml, /WEB-INF/struts-auto-config-helloWorld.xml</param-value>
    </init-param>
  3. Create the action class, along with the form bean, and add its entry to the struts-config file you created.
  4. Create a struts validation XML file and define the validation XML file in the struts-config file.
    <plug-in className=”org.apache.struts.validator.ValidatorPlugIn”>
    <set-property property=”pathnames” value=”/WEB-INF/validation-struts-auto-config-helloWorld.xml”/>
    </plug-in>
  5. Add the BEA Request Processor entry in struts-config file.
    <controller inputForward=”true” processorClass=”com.bea.struts.adapter.action.AdapterRequestProcessor”/>
  6. To create a portlet that uses an action defined in the struts-config file, right-click on the struts-config file, choose “Generate Portlet”.Portlet Wizard 2
  7. The Configuration file and Module path is filled with the values. Click the “Add” button to add the struts-config file.
  8. Portlet Wizard 3In the next step of the portlet creation wizard, choose the action that represents the default view of the portlet then finish the wizard.
  9. Create a class that subclass the “com.bea.netuix.servlets.controls.content.backing.AbstractJspBacking” then, use the created class name, and put it into the portlet attribute “backingFile”.
  10. Make sure to add the views of the portlet, under the struts module directory.
  11. When defining views/forwards in the struts-config file, add the module attribute with the value “/[struts_module]”. <forward module=”/strutsPortlet” path=”/views/default.jsp” name=”default”/>.
  12. Search for the struts-adapter.jar inside the weblogic server, extract the TLD files : struts-adapter-html.tld, struts-adapter-naming.tld , struts-adapter-nested.tld & struts-adapter-tiles.tld, then add them to the project under lib directory.
  13. Refer to these taglibs in the views created as needed, instead of reglar struts TLD files. <%@ taglib uri=”http://bea.com/struts/adapter/tags-html&#8221; prefix=”html” %>
  14. To support adding struts file upload, you must add multi part request processor to the struts-config file, along with the added portal request processor. This is a fix included in WebLogic Portal 10.3 PSU3 (10.3.1.0.3) and 10.3.2. You have to install the patch first using Smart Update that comes with Weblogic installation. <controller inputForward=”true” processorClass=”com.bea.struts.apadter.action.AdapterRequestProcessor” multipartClass=”com.bea.struts.adapter.action.ScopedMultipartRequestHandler” />.
Advertisements
Categories Weblogic PortalTags , , , , , ,

4 thoughts on “Create Struts Portlet in Weblogic Portal 10.3

  1. Thanks for writing this. We are running into the same issue when using WL Portal 10.3.2 with the Struts 1.3 facet, and only the multipart forms are failing. I first tried to search all JARs and files for ScopedMultipartRequestHandler, but that class is nowhere to be found with the standard 10.3.2 full Portal installtion. I then downloaded all public patches for WL 10.3.2, and installed them. And again, that class is nowhere to be found. Can you tell me exactly what the BEA patch number is to address this issue and to get that specific class? Thanks! – Thuy Nguyen of Level 3 Communications, LLC.

    1. Yes you are right about that . I was not able to find weather the patch nor the class. I am trying to contact Oracle Support to resolve this issue.

      1. Ahmad,
        We were able to contact BEA (aka Oracle Support) and get the specific patch that actually contains the ScopedMultipartRequestHandler class. As suspected, the patch is NOT a public patch. Thereore, you can’t get it unless you aske Oracle for it. The patch ID is GG16. Again, it is a private patch for WLP Version 10.3.2, and you have to ask Oracle for it and they will give you a passcode to download it and apply it to your BEA installation directory. Once applied, the ScopedMultipartRequestHandler will be the sole class in new JARs named: wlp-framework-struts-1.1-web-lib.war, wlp-framework-struts-1.2-web-lib.war, and wlp-framework-struts-1.3-web-lib.war. We got the patch and are using it now as of 03/31/2011. Thanks.

  2. Good post but I have an inquiry regarding deployment

    I have around 50 struts portlets in my weblogic portal, so we have now one ear which ends up that whenever we change any portlet or need to add a new module we will have to redeploy the whole portal !!!
    I have read about federated portal, but it seems that its great advantage is when your portal wants to consume remote portlets deployed in remote producers, but this is not my case, since all my portlets are local ones, so I think there might be a simpler solution (*like in websphere where we have separate war for each portlet*)

    How can I accomplish this in WebLogic, deploying each module in a seperate WAR?
    Any suggestions?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close