Hi, i'm new to portlets and have a problem with a struts portlet that I want to 
use remote via WSRP.

I have made a simple struts portlet using portal-bridges and it works just fine 
when it's used as a local portlet. 

I configure 2 portals (JBoss Portal 2.7) and set up my portlet as remotable in 
the producer portal and then try to use it in the consumer portal. That also 
works, BUT... 

When I send a request parameter and try to use it in the Action class its 
empty... 

Can anyone help me?

Regards, Henric

struts-config.xml

  | <?xml version="1.0" encoding="ISO-8859-1"?>
  | <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts 
Configuration 1.1//EN"
  |                                
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
  | <struts-config>
  |  <data-sources/>
  |  <form-beans>
  |   <form-bean name="testForm" type="org.apache.struts.action.DynaActionForm">
  |    <form-property name="inputValue" type="java.lang.String"/>
  |    <form-property name="outputValue" type="java.lang.String"/>
  |   </form-bean>
  |  </form-beans>
  |  <global-exceptions/>
  |  <global-forwards/>
  |  <action-mappings>
  |   <action input="index.jsp" name="testForm" path="/testAction"
  |    scope="session" type="TestAction" validate="false">
  |    <forward name="success" path="/success.jsp" redirect="true"/>
  |    <forward name="failure" path="/failure.jsp" redirect="true"/>
  |   </action>
  |   <action include="/index.jsp" path="/index" name="testForm"/>
  |   <!-- CATALOG ACTIONS -->
  |  </action-mappings>
  |  <controller inputForward="false" pagePattern="$M$P" 
processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>
  | </struts-config>
  | 
  | 

TestAction.java


  | 
  | public class TestAction extends Action {
  |     
  |     public ActionForward execute(ActionMapping mapping, ActionForm form,
  |             HttpServletRequest request, HttpServletResponse response)
  |             throws Exception {
  | 
  |         ActionForward forward = new ActionForward(); 
  |         DynaActionForm searchForm = (DynaActionForm)form;
  | 
  |         try {
  |             // Get input value
  |             String value = (String)searchForm.get("inputValue");
  |             
  |             System.out.println("InputValue: " + value);
  |             
  |             // Modify input value
  |             searchForm.set("outputValue", value + " modded");
  |         
  |             forward = mapping.findForward("success");
  |                     
  |         } catch (Exception e) {
  |             System.out.println(e.getMessage()+e.getClass());
  |             forward = mapping.findForward("failure");
  |         }
  |         return (forward);
  |     }
  | 
  | }
  | 

portlet.xml


  | 
  | <?xml version="1.0" encoding="UTF-8"?><portlet-app 
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";
  |     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
  |     
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd 
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"; 
  |     version="2.0">
  |     
  |     <portlet id="Portlet2Struts.id">
  | 
  |             <description>Test</description>
  |             <portlet-name>Portlet2Struts</portlet-name>
  |             <display-name>Portlet2Struts</display-name>
  |             <portlet-class>
  |                     org.apache.portals.bridges.struts.StrutsPortlet
  |             </portlet-class>
  |         <init-param>
  |             <name>ServletContextProvider</name>
  |             
<value>org.jboss.portal.portlet.bridge.JBossServletContextProvider</value>
  |         </init-param>
  |             <init-param>
  |                     <name>ViewPage</name>
  |                     <value>/index.mcnz</value>
  |             </init-param>
  |             <expiration-cache>-1</expiration-cache>
  |             <supports>
  |                     <mime-type>text/html</mime-type>
  |                     <portlet-mode>VIEW</portlet-mode>
  |             </supports>
  |             <portlet-info>
  |                     <title>Portlet 2.0 Struts test</title>
  |                     <keywords></keywords>
  |             </portlet-info>
  |     </portlet>      
  | 
  | </portlet-app>
  | 
  | 

index.jsp


  | 
  | <%@ page contentType="text/html"%>
  | <%@ taglib uri="http://portals.apache.org/bridges/struts/tags-portlet-html"; 
prefix="html"%>
  | 
  | <TABLE border=0 cellSpacing=0 width="100%">
  | <TR>
  | <TD vAlign=top width=100%>
  | <html:form action="testAction">
  | Input:
  | <html:text property="inputValue"></html:text>
  | <input type="submit" name="submit" value="Sök">
  | </html:form>
  | </TD>
  | </TR>
  | </TABLE>
  | 
  | 

success.jsp


  | 
  | <%@ taglib uri="http://portals.apache.org/bridges/struts/tags-portlet-html"; 
prefix="html" %>
  | <%@ taglib uri="http://struts.apache.org/tags-bean"; prefix="bean"%>
  | <%@ taglib uri="http://struts.apache.org/tags-logic"; prefix="logic"%>
  | 
  | <%@ page  contentType="text/html"%>
  | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
  | <html>
  | <head>
  | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  | <title>Info</title>
  | </head>
  | <body>
  |     Modded input is:<bean:write name="testForm" property="outputValue"/><br>
  |     <html:form action="index">
  |             <html:submit>
  |             Tillbaka        
  |             </html:submit>
  |     </html:form>
  |     </p>
  | </body>
  | </html>
  | 
  | 

output

12:22:58,363 INFO  [STDOUT] InputValue:

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181206#4181206

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181206

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to