Hallo Martin,
if I see that right, you speak german too - so lets make it a little easier -
if not - just ignore the rest of the message! ;)
Das Ganze ist ein bisschen komplizierter als das Ändern des Mime Types.
Um das ganze mal ein bisschen detailierter zu umreißen - ist mir im englischen
zu kompliziert:
Ich rufe eine Action auf, die sich solange selbst aufruft und ein tiles
Ergebnis zurückliefert bis alle notwendigen Eingaben vorgenommen sind.
Im Code sieht der Aufruf etwa so aus:
<s:iterator value="documents" var="document">
<s:url var="urlOpenDoc" action>
<s:param name="documentId" value="#document.id" />
</s:url>
<sx:a href="${urlOpenDoc}" targets="dialogContainer"><s:property
value="#document.name" /></s:a>
</s:iterator>
Solange ich ein Tile als Ergebnis bekomme ist alles schön und gut. Das wird
korrekt dargestellt.
Wenn aber alle Eingaben erledigt sind, liefert die Action ein Stream result
zurück.
<result name="download" type="stream">
<param
name="contentType">application/octet-stream</param>
<param name="inputName">inputStream</param>
<param
name="contentDisposition">filename="${fileName}"</param>
<param name="bufferSize">1024</param>
</result>
Das ist schon entsprechend Konfiguriert um eine Datei zum Download anzubieten.
Problem an der Stelle ist dann nur, dass der Aufruf über Ajax erfolgt und als
Target immer noch den dialogContainer hat.
Der Stream wird also im dialogContainer angezeigt, aber nicht als Download.
Ich muss also irgendwie aus der Action heraus sagen - hey - das ist kein tile,
das ist ein Download - also geh nicht in das Target, sondern geh in das
"Fenster" und zeig mir den Download Dialog.
Ist glaube ich immer noch recht chaotisch und unverständlich, aber vielleicht
wird jetzt etwas deutlicher, was genau ich für ein Problem hab.
Vielen Dank auf jeden Fall!!
Viele Grüße
Jan
-----Ursprüngliche Nachricht-----
Von: Martin Gainty [mailto:[email protected]]
Gesendet: Mittwoch, 8. Juli 2009 15:05
An: Struts Users Mailing List
Betreff: RE: AW: [S2.1.2] sx:div targets AKA sx:a targets
early here in EDT so I'll make the suggestion for the Action class changing the
ContentType
FileUploadAction.setContentType("application/octet-stream");
mit freundlichen Grüßen
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
> Subject: AW: [S2.1.2] sx:div targets AKA sx:a targets
> Date: Wed, 8 Jul 2009 12:08:26 +0200
> From: [email protected]
> To: [email protected]
>
> Martin & Musachy, thank you for your replies.
>
> @Martin, sorry that I couldn't make it that clear - "dialogContainer" is a
> div that is embedded in my page.
>
> @Musachy
> I did some more research, and I guess I can't solve it in any way.
> If my action returns "prompt" (tiles) it works like a charm and updates my
> "dialogContainer" with the specified tile.
> But when it returns "download" (stream) it doesn't matter (afaik) which
> targets I define, cause an ajax request wont start a file download in any
> case.
>
> What could solve my problem is something like a javascript, that takes the
> returned stream from the action and instead of updating the targets-component
> it should change the mime type to application/octet-stream and writes it
> (maybe) to a new window.
>
> Hope its now understandable what I need to do! ;)
>
> Thanks again!
>
> Kind regards
> Jan
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Musachy Barroso [mailto:[email protected]]
> Gesendet: Dienstag, 7. Juli 2009 20:14
> An: Struts Users Mailing List
> Betreff: Re: [S2.1.2] sx:div targets AKA sx:a targets
>
> targets can be set like anything else, with an ognl expression, like
>
> <s:a .... targets="%{targets}" ..
>
> then you need a getTargets() method in your action. Is that what you
> need? or you need to modify the targets on the client side, meaning in
> javascript?
>
> musachy
>
> 2009/7/7 Jan Fröhlich <[email protected]>:
> > Wrong subject! ;)
> >
> > ________________________________
> >
> > Von: Jan Fröhlich [mailto:[email protected]]
> > Gesendet: Di 07.07.2009 16:55
> > An: Struts Users Mailing List
> > Betreff: [S2.1.2] sx:div targets
> >
> >
> >
> > Hi all,
> >
> > I've seen this topic beeing discussed several times already, but I didn't
> > find a solution that works for me.
> >
> > What I already got:
> > I invoke an action with a sx:a (targets="dialogContainer"). The action
> > opens a document and has two possible return values: "prompt" and
> > "download".
> > "prompt" means, that there are several information necessary before the
> > document can be downloaded. It is type="tiles".
> > "download" means, that the document is ready for download. It is
> > type="stream".
> >
> > On the "prompt" page is a finish button, that has no targets set, so the
> > download starts fine.
> > If the action returns "download" immediately it shows the stream in the
> > specified "dialogContainer".
> >
> > What I need is to modify the targets value out of my action.
> >
> > I tried it from within the action and with an interceptor, but it seems
> > like I can't access the "targets" in the ValueStack.
> > Another way I tried, was to use afterNotifyTopics and redirect the data to
> > what I want - but that didn't work either. (Problem with the stream result)
> >
> > Can someone give me a hint, how I can possibly solve it?
> > I even thought about modifying the freemarker template for the anchor tag -
> > but I couldn't find the right spot, where to do it.
> >
> > Any help appreciated!
> >
> > Kind regards
> > Jan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
_________________________________________________________________
Windows Live(tm) SkyDrive(tm): Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]