You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Bela Kovac <wi...@uni-paderborn.de> on 2004/01/14 16:58:38 UTC
JSP Portlet -- Action Part
Hi,
after managing to get a very simple (hello World) JSP portlet on
screen, i have another question:
Now i want the portlet to get a string via web formular and then show
it. Something like the "HelloVelocity" portlet, but i want to do this
entirely in JSP. So i made up three files:
.../jetspeed/WEB-INF/templates/jsp/portlets/html/helloWorld.jsp:
================================================================
<%@ page language="java"
session="false"
%>
<%@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld'
prefix='jetspeed' %>
<p>
<b>Hello World!</b>
</p>
<%
String jspeid = (String) request.getAttribute("js_peid");
String textString = (String) request.getAttribute("textString");
%>
<p>
Aktueller Text-String:
<br>
<%=textString%>
</p>
<p>
Neuen Text eingeben:
<br>
<form method="post" action="<jetspeed:dynamicUri/>">
<input type="hidden" name="js_peid" value="<%=jspeid%>">
<input type="text" name="textString" value="<%=textString%>">
<input type="submit" name="refresh" value="Aktualisieren">
</form>
</p>
.../jetspeed/WEB-INF/conf/helloWorld.xreg
=========================================
<?xml version="1.0" encoding="UTF-8"?>
<registry>
<portlet-entry name="HelloWorld" hidden="false" type="ref"
parent="JSP" application="false">
<meta-info>
<title>HelloWorld</title>
<description>Mein erstes Jetspeed JSP-Portlet</description>
</meta-info>
<parameter name="template" value="helloWorld.jsp" hidden="true"
cachedOnName="true" cachedOnValue="true"/>
<parameter name="action" value="portlet.helloWorldAction"
hidden="true" cachedOnName="true" cachedOnValue="true"/>
<parameter name="textString" value="Test-Test. 1-2-3."
hidden="true" cachedOnName="true" cachedOnValue="true"/>
<media-type ref="html"/>
<url cachedOnURL="true"/>
</portlet-entry>
</registry>
.../jetspeed/WEB-INF/classes/org/apache/jetspeed/modules/
helloWorldAction.class
(Here the source code from the corresponding helloworldAction.java:)
========================================================================
======
package org.apache.jetspeed.modules;
// Turbine stuff
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
import org.apache.turbine.services.TurbineServices;
// Jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.modules.actions.portlets.JspPortletAction;
import
org.apache.jetspeed.webservices.finance.stockmarket.StockQuoteService;
import org.apache.jetspeed.webservices.finance.stockmarket.StockQuote;
import org.apache.jetspeed.util.PortletConfigState;
import org.apache.jetspeed.util.PortletSessionState;
import org.apache.jetspeed.util.StringUtils;
public class helloWorldAction extends JspPortletAction {
private static final String SYMBOLS = "textString";
protected void buildNormalContext(Portlet portlet, RunData rundata)
{
// receive
String symbols = (String)
PortletSessionState.getAttributeWithFallback(portlet, rundata,
SYMBOLS);
// set
rundata.getRequest().setAttribute(SYMBOLS, symbols);
}
}
The action part isn't working within my jetspeed installation
(.../jetspeed/WEB-INF/log/jetspeed.log):
[...]
2004-01-14 16:49:57,676 [http8080-Processor23] DEBUG GenericMVCPortlet
- GenericMVCPortlet: Executing action [portlet.helloWorldAction] for
portlet [HelloWorld]
2004-01-14 16:49:57,714 [http8080-Processor23] ERROR GenericMVCPortlet
- GenericMVCPortlet - error executing
actionjava.lang.ClassNotFoundException:
Requested Action not found: portlet.helloWorldAction
Turbine looked in the following modules.packages path:
[org.apache.jetspeed.modules, org.apache.turbine.modules]
[...]
To be honest, i have no idea where to put the class file. All the
tutorials don't help me, and i don't find the Action-Files from the
demo-jsp-portlets (e.g. Jsp Stock Portfolio). The tutorial and the docs
don't explain this matter very good.
So, my question: where have i to put that helloWorldAction.class in? If
this is a newbie question which was answered before, please let me know
where to find it.
Grateful for any answer,
Bela
--
"Der Blitzableiter auf einem Kirchturm ist das denkbar stärkste
Misstrauensvotum gegen den lieben Gott."
-- Karl Kraus
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org