You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Joachim Dagerot <je...@dagerot.nu> on 2003/05/29 23:01:14 UTC
Can't get JSP/Portlet to work with actions.
I have a class:
public class ShoppingList extends JspPortletAction
And it works great together with my jsp as stated in the registry:
<portlet-entry name="Shopping1" hidden="false" type="ref"
parent="JSP" application="false">
<meta-info>
<title>Shopping1</title>
<description> SHOP1 </description>
</meta-info>
<classname>org.apache.jetspeed.portal.portlets.JspPortlet</classname>
<parameter name="template" value="shopping.jsp" hidden="true"
cachedOnName="true" cachedOnValue="true"/>
<parameter name="action" value="portlets.ShoppingList"
hidden="true" cachedOnName="true" cachedOnValue="true"/>
<media-type ref="html"/>
<url cachedOnURL="true"/>
<category group="Jetspeed">Dagerot</category>
<category group="Jetspeed">dev.test</category>
</portlet-entry>
The buildMaximizedContext and buildNormalContext works as expected. So
I have no doubt that all classes and paths are good.
However I can't manage to get an action from the JSP to work, here's
the JSP code:
<form method="post" action="<jetspeed:dynamicUri/>">
<input type="hidden" name="action" value="portlets.ShoppingList"/>
<table>
<tr>
<th>Ingredient</th><th>Amount</th>
</tr>
<tr><td><input name="ingredient"></input></td><td><input
name="amount"></input></td><td> <input type="submit"
name="eventSubmit_addEntry" value="Save"/></td></tr>
</table>
</form>
and here is another fragment from the JSP (for tracking)
<%
String res = (String) request.getAttribute("JDresult");
if(res!=null) out.println(res); else out.println("result was
null");
%>
I have a addEntry in my class:
public void addEntry(RunData rundata, Portlet arg0) {
rundata.getRequest().setAttribute("JDresult", "Coolness");
checkAndDoAdditions(rundata);
}
But it's never called. The checkAndDoAdditions() adds data to a
database if some parameters exists. If it's ran from the
buildMaximizedContext (or the normal) it's updating into the database
when I press the submit-button above. But when ran from my action
addEntry nothing happens.
I am really stuck here, I have followed all tutorials and guidlines
there is, but no luck.
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org