Foros de discusión

StrutsAction und Hooks

Lisa Gunkel, modificado hace 13 años.

StrutsAction und Hooks

New Member Mensajes: 23 Fecha de incorporación: 26/10/10 Mensajes recientes
Hallo zusammen,

ich bin noch nicht all zu lange im Liferay-Umfeld, daher mal eine Frage zu Hooks und StrutsAction.

Kann man per Hook neue StrutsActions hinzufügen???

Gedacht hatte ich mir das so:
1. eine neuen Hook anlegen und die Jsp-Seite (portle/admin/server.jspf) überschreiben, die um einen Button erweitert werden soll
Und dort folgenden Link und Scriptschnippsel einfügen

<a href="javascript:<portlet:namespace />exportProperties();"><liferay-ui:message key="exportProperties" /></a>

<aui:script>
function <portlet:namespace />exportProperties() {
alert("Test");
document.<portlet:namespace />fm.method = "post";
submitForm(document.<portlet:namespace />fm, "<portlet:actionURL><portlet:param name="struts_action" value="/export_properties" /></portlet:actionURL>");
}
</aui:script>

2. Es gibt ja die struts-config-ext. Diese im Hook im WebInf-Verzeichniss anlegen und folgendes einfügen

<action-mappings>
<action path="/export_properties" type="test.service.exportProperties.ExportProperties">
</action>
</action-mappings>

3. Die Klasse ExportProperties anlegen, die im Prinzip nichts andere macht als die Properties in eine Csv-Datei auszugenen (Analog dem Export von Usern -> ExportUsersAction.class)

Tja, leider funktioniert das so nicht?
Ist es nicht möglich per Hook die Actions zu erweitern? Muss man dazu Ext verwenden?

Ich hab dann einfach, um zu schauen, ob das überhaupt geht mal anstatt mein neue Struts-Action zu verwenden, eine vorhandene verwendet, eben genau die ExportUserAction verwendet

in JavaScript-Abschnitt folgendes reingeschrieben:
submitForm(document.<portlet:namespace />fm, "<portlet:actionURL><portlet:param name="struts_action" value="/enterprise_admin/export_users" /></portlet:actionURL>&etag=0&strip=0&compress=0");

Aber das geht überhaupt nicht...es wird zwar neu gerendert...aber nichts passiert :-/

Kann mir jemand erklären, wie das mit den Struts-Action genau funktioniert?

Viele Dank

Lisa
thumbnail
Mika Koivisto, modificado hace 13 años.

RE: StrutsAction und Hooks

Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
I'll answer in English as my German isn't that great. Currently adding new struts actions or extending existing one is not available but it will be soon see my blog post.

So for now you need to use Ext to add new Struts Actions the way you described. The problem you is that your struts action is missing the first part /enterprise_admin/ from the path. So your struts path should be /enterprise_admin/export_properties.

Hope this helps.
Lisa Gunkel, modificado hace 13 años.

RE: StrutsAction und Hooks

New Member Mensajes: 23 Fecha de incorporación: 26/10/10 Mensajes recientes
Hello,

Thanks a lot. This Answers helps me.


Lisa