|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
|
|
download fileplease
can anyone send me the cplete code to create an action which allows to download a file |
|
|
Re: download fileHi,
read this: http://struts.apache.org/2.0.6/docs/stream-result.html and this (note that it's to much as for a simple download but that's what i've got): package com.ppp.oko.struts.action.motion.file; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.text.ParseException; import java.util.Map; import javax.servlet.ServletContext; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.interceptor.SessionAware; import org.apache.struts2.util.ServletContextAware; import com.opensymphony.xwork2.ActionSupport; import com.pi.eplatform.suirz.common.DateRepresentation; import com.ppp.oko.logic.MotionFile; import com.ppp.oko.logic.user.Obserwator; import com.ppp.oko.logic.user.User; import com.ppp.oko.persistence.prevayler.Motion; @Result(name="success", type="stream", params={"contentType", "image/jpeg"}) public class ShowAction extends ActionSupport implements ServletContextAware, SessionAware { private static final long serialVersionUID = 1L; private String number; private String date; private long id; private ServletContext sc; private Map<String, Object> sessionMap; public InputStream getInputStream() throws ParseException, FileNotFoundException { Motion motion = ((Obserwator) sessionMap.get(User.class.toString())).getMotion(new DateRepresentation(date), number); MotionFile motionFile = motion.getMotionFile(id); String appPath = sc.getRealPath("."); String pathname = appPath+"/WEB-INF/user/fotki/"+motionFile.getMotionFileName(); return new FileInputStream(new File(pathname)); } public void setNumber(String number) { this.number = number; } public void setDate(String date) { this.date = date; } public void setId(long id) { this.id = id; } @Override public void setServletContext(ServletContext arg0) { this.sc = arg0; } @Override public void setSession(Map<String, Object> map) { this.sessionMap = map; } } Hope that helps, Paweł Wielgus. 2009/6/16 PEGASUS84 <pegasus84@...>: > > please > can anyone send me the cplete code to create an action which allows to > download a file > -- > View this message in context: http://www.nabble.com/download-file-tp24050039p24050039.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: download fileRight it's really too much because i've not many packages that you've used. is there a more simple code ? |
|
|
Re: download fileNope, that's all i've got,
but You can try to remove all that's unimportant. Best greetings, Paweł Wielgus. 2009/6/16 PEGASUS84 <pegasus84@...>: > > > Right it's really too much > because i've not many packages that you've used. > > is there a more simple code ? > -- > View this message in context: http://www.nabble.com/download-file-tp24050039p24050650.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: download filesorry,
i don't succeed i haven't idea |
|
|
Re: download fileYou can't expect someone else to write your code for you...
What have you tried? What errors did you get? You have to at least provide some informatino for us to help you. Nils-H On Tue, Jun 16, 2009 at 11:54 AM, PEGASUS84<pegasus84@...> wrote: > > sorry, > i don't succeed > i haven't idea > -- > View this message in context: http://www.nabble.com/download-file-tp24050039p24051122.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: download filemy action is this:
public class FileDownload extends ActionSupport { InputStream inputStream; public void setInputStream(InputStream s){inputStream=s;} public InputStream getInputStream(){return inputStream;} public String execute(){ return "sendFile"; } } and in Struts.xml i've this: <action name="fileDownload" class="action.FileDownload" > <result name="sendFile" type="stream"> ${contentType} </result> </action> i wish to download a file |
|
|
Re: download fileAnd where does your input stream come from?
On Tue, Jun 16, 2009 at 12:11 PM, PEGASUS84<pegasus84@...> wrote: > > my action is this: > public class FileDownload extends ActionSupport { > > InputStream inputStream; > > > public void setInputStream(InputStream s){inputStream=s;} > public InputStream getInputStream(){return inputStream;} > > public String execute(){ > return "sendFile"; > } > } > and in Struts.xml i've this: > > <action name="fileDownload" class="action.FileDownload" > > <result name="sendFile" type="stream"> > ${contentType} > </result> > </action> > > i wish to download a file > -- > View this message in context: http://www.nabble.com/download-file-tp24050039p24051377.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: download filePEGASUS84 wrote:
> my action is this: > public class FileDownload extends ActionSupport { > > InputStream inputStream; > > > public void setInputStream(InputStream s){inputStream=s;} > public InputStream getInputStream(){return inputStream;} > > public String execute(){ > return "sendFile"; > } > } > and in Struts.xml i've this: > > <action name="fileDownload" class="action.FileDownload" > > <result name="sendFile" type="stream"> > ${contentType} > </result> > </action> > > i wish to download a file So you'll need a "contentType" action property. If you look at Pawel's email you'll see where he opens a file and uses it as the input stream: String pathname = appPath + "/WEB-INF/user/fotki/" + motionFile.getMotionFileName(); return new FileInputStream(new File(pathname)); There's also a complete example in the showcase application. Dave --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: download filethanks,
now there is a problem in struts.xml: Can not find a java.io.InputStream with the name [${contentType}] in the invocation stack. Check the |
|
|
Re: download fileTake a look at Pawel and Dave's replies once again.
Nils-H On Wed, Jun 17, 2009 at 8:55 AM, PEGASUS84<pegasus84@...> wrote: > > thanks, > now there is a problem in struts.xml: > Can not find a java.io.InputStream with the name [${contentType}] in the > invocation stack. Check the > > > -- > View this message in context: http://www.nabble.com/download-file-tp24050039p24067967.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
[S2.1.2] sx:div targetsHi 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: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
[S2.1.2] sx:div targets AKA sx:a targetsWrong subject! ;)
________________________________ Von: Jan Fröhlich [mailto:Jan.Froehlich@...] 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: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: [S2.1.2] sx:div targets AKA sx:a targetstargets 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 <Jan.Froehlich@...>: > Wrong subject! ;) > > ________________________________ > > Von: Jan Fröhlich [mailto:Jan.Froehlich@...] > 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: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: [S2.1.2] sx:div targets AKA sx:a targetsjan the target refers to the component whose content will be updated <img id="loadingImage" src="images/loadingAnimation.gif" style="display:none"/> <s:div id="parentDiv"> <s:form action="actionName"> <sx:a targets="parentDiv" showLoadingText="false" indicator="loadingImage"/> dialogContainer is too general and not a component per se best to identify a div tag such as parentDiv http://struts.apache.org/2.1.6/docs/dojo-anchor.html Mit Freundlichen Grueben/ 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: [S2.1.2] sx:div targets AKA sx:a targets > Date: Tue, 7 Jul 2009 19:56:21 +0200 > From: Jan.Froehlich@... > To: user@... > > Wrong subject! ;) > > ________________________________ > > Von: Jan Fröhlich [mailto:Jan.Froehlich@...] > 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: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > > _________________________________________________________________ Windows Live™: Keep your life in sync. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_BR_life_in_synch_062009 |
|
|
AW: [S2.1.2] sx:div targets AKA sx:a targetsMartin & 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:musachy@...] 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 <Jan.Froehlich@...>: > Wrong subject! ;) > > ________________________________ > > Von: Jan Fröhlich [mailto:Jan.Froehlich@...] > 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: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: AW: [S2.1.2] sx:div targets AKA sx:a targetsearly 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: Jan.Froehlich@... > To: user@... > > 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:musachy@...] > 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 <Jan.Froehlich@...>: > > Wrong subject! ;) > > > > ________________________________ > > > > Von: Jan Fröhlich [mailto:Jan.Froehlich@...] > > 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: user-unsubscribe@... > > For additional commands, e-mail: user-help@... > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@... > > For additional commands, e-mail: user-help@... > > > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > _________________________________________________________________ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009 |
|
|
AW: AW: [S2.1.2] sx:div targets AKA sx:a targetsHallo 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:mgainty@...] 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: Jan.Froehlich@... > To: user@... > > 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:musachy@...] > 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 <Jan.Froehlich@...>: > > Wrong subject! ;) > > > > ________________________________ > > > > Von: Jan Fröhlich [mailto:Jan.Froehlich@...] > > 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: user-unsubscribe@... > > For additional commands, e-mail: user-help@... > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@... > > For additional commands, e-mail: user-help@... > > > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > _________________________________________________________________ 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: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: AW: [S2.1.2] sx:div targets AKA sx:a targetsTrust me, it is not a language problem.
musachy 2009/7/8 Jan Fröhlich <Jan.Froehlich@...>: > 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:mgainty@...] > 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: Jan.Froehlich@... >> To: user@... >> >> 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:musachy@...] >> 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 <Jan.Froehlich@...>: >> > Wrong subject! ;) >> > >> > ________________________________ >> > >> > Von: Jan Fröhlich [mailto:Jan.Froehlich@...] >> > 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: user-unsubscribe@... >> > For additional commands, e-mail: user-help@... >> > >> > >> > >> > >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: user-unsubscribe@... >> > For additional commands, e-mail: user-help@... >> > >> >> >> >> -- >> "Hey you! Would you help me to carry the stone?" Pink Floyd >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> > > _________________________________________________________________ > 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: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
AW: AW: [S2.1.2] sx:div targets AKA sx:a targetsHi musachy,
oops - I thought I sent the mail just to Martin. :D However with that mail I just wanted to explained to him, what my problem is - cause I thought he might have misunderstood what I mean. What I think is, that there is no way to achieve what I want to do. Guess that's what you are telling me too! Thanks so far! Jan -----Ursprüngliche Nachricht----- Von: Musachy Barroso [mailto:musachy@...] Gesendet: Mittwoch, 8. Juli 2009 16:52 An: Struts Users Mailing List Betreff: Re: AW: [S2.1.2] sx:div targets AKA sx:a targets Trust me, it is not a language problem. musachy 2009/7/8 Jan Fröhlich <Jan.Froehlich@...>: > 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:mgainty@...] > 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: Jan.Froehlich@... >> To: user@... >> >> 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:musachy@...] >> 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 <Jan.Froehlich@...>: >> > Wrong subject! ;) >> > >> > ________________________________ >> > >> > Von: Jan Fröhlich [mailto:Jan.Froehlich@...] >> > 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: user-unsubscribe@... >> > For additional commands, e-mail: user-help@... >> > >> > >> > >> > >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: user-unsubscribe@... >> > For additional commands, e-mail: user-help@... >> > >> >> >> >> -- >> "Hey you! Would you help me to carry the stone?" Pink Floyd >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> > > _________________________________________________________________ > 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: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |