Oleg, what "Official" page are you talking about?  The docs or the fully 
functional example in the demo project?  If you're talking about the docs, 
understand that they assume you have a fully and correctly constructed page 
AROUND the listener.

Scott

Sent from my iPhone

On Jun 17, 2011, at 8:27 AM, jitechno <[email protected]> wrote:

> 
> Scott, I dont ask you or other person do my work. I dont think, adding
> download link reuires researches? manuals and debugging.
> 
> But, if I got example from "official" page, I want to rely on it. So, now I
> really dont understand situation.
> I put a lot of efforts to write application and I want to complete it.
> It is not a question of testing  functionality. I am not able (and I dont
> want ) to learn product without  functional examples. I did not find any
> working example how to download file with tr:fileDownloadActionListener.
> Better, I will put standard links to files, so user will download files with
> standard browser's dialog.
> regards
> 
> 
> 
> Scott O'Bryan wrote:
>> 
>> Yeah Oleg,
>> 
>> I'm certainly willing to help but I'm not willing to write your
>> application for you or, necessarily, debug it.  If there is a problem with
>> Trinidad, then we certainly want tp know about it, but short of that, my
>> goal is to teach you how to work within the Trindad framework so that you
>> can overcome obsticals on your own.
>> 
>> If your intention is just to test out this functionality, I invite you to
>> try out the 'feature demo' of the Trinidad Demo application.  I believe
>> there are instructions for running it under jetty using a single maven
>> command and you'll be up and running in no time.
>> 
>> Further you can use the example as a template for writing your own pages
>> if you wish.
>> 
>> Hope that helps.
>>  Scott
>> 
>> Sent from my iPhone
>> 
>> On Jun 17, 2011, at 5:20 AM, Martin Koci <[email protected]>
>> wrote:
>> 
>>> Hi,
>>> 
>>> jitechno píše v Pá 17. 06. 2011 v 01:41 -0700:
>>>> Scott, may be, there is a little misunderstanding. My question is not
>>>> about
>>>> debugging and reverse engineering, but about general approach.
>>>> I am trying realize example from "official" Trinidad's page. At least, I
>>>> am
>>>> considering as official. Am I right?
>>>> 
>>>> http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_fileDownloadActionListener.html
>>>> 
>>>> Usually, such examples give a good base to start with more deep
>>>> development. In this case, it is no.
>>>> This example doesnot cover complete solution, or obsolete, or belongs to
>>>> other version.
>>> 
>>> That example is ok, we use it over 4 years in many production systems.
>>> 
>>>> I have not time to explore ans investigate basic elementary
>>>> construction,
>>>> it is not a subject of research for programmer. May be, I am wrong or my
>>>> understanding of myfaces.apache's policy is incorrect?
>>>> 
>>>> I dont know which tag is giving the problems, because I dont see any
>>>> action
>>>> after clicking on commandLink or button, inside form or outside. Also I
>>>> dont
>>>> see any exceptions/messages form Tomcat.
>>> 
>>> Firefox -> Tools -> Error Console. You'll see javascripts errors. The
>>> main probem is that you have no tag for including resources in your
>>> view. In case of JSP, use tr:document as Scott suggests. I case of
>>> facelets, you can use tr:document too or new h:head/h:body tags. Anyway,
>>> please read this resource:
>>> http://andyschwartz.wordpress.com/2009/07/31/whats-new-in-jsf-2/#resource-loading
>>> 
>>> Regards,
>>> 
>>> Kočičák
>>> 
>>>> Regards
>>>> Oleg
>>>> 
>>>> 
>>>> Scott O'Bryan wrote:
>>>>> 
>>>>> Oleg, events usually require a form in order to submit the data needed
>>>>> to process the event.  Additionally, which tag is giving you the
>>>>> problems?  To debug this problem, I would start by trying a simpler
>>>>> page without mixing render kits and then go from there.  Use the
>>>>> <tr:document> tag at the root, include to form, and so on.  Once you
>>>>> do this, you can reverse engineer your app to see what's happening.
>>>>> Understand also that JSF and TRINIDAD also have replacements for some
>>>>> elements that you usually use with HTML.  You need to use these
>>>>> replacements for things to get inserted properly.
>>>>> 
>>>>> Scott
>>>>> 
>>>>> Sent from my iPad
>>>>> 
>>>>> On Jun 16, 2011, at 2:18 AM, jitechno <[email protected]> wrote:
>>>>> 
>>>>>> 
>>>>>> Cedric, why I need form tag here?
>>>>>> I dont think so. because no need to use form and submit for download
>>>>>> file
>>>>>> in
>>>>>> browser.
>>>>>> But tr:form is not solution, still the same behavior.
>>>>>>  <body>
>>>>>> 
>>>>>>     <f:view>
>>>>>>          <h1><h:outputText value="JSF 2.0 + Trinidad 2.0"/></h1>
>>>>>>          <tr:form id="downloadForm" >
>>>>>>          <h:commandButton value="Download"
>>>>>> styleClass="submit_button">
>>>>>>          <tr:fileDownloadActionListener
>>>>>> filename="#{downloadBean.fileName}"
>>>>>> 
>>>>>> contentType="#{downloadBean.contentType}"
>>>>>> 
>>>>>> method="#{downloadBean.sayHello}"/>
>>>>>>          </h:commandButton>
>>>>>> 
>>>>>>     <tr:commandLink text="Download file">
>>>>>>     <tr:fileDownloadActionListener
>>>>>>                              filename="hello.txt"
>>>>>>                              contentType="text/plain; charset=utf-8"
>>>>>>                              method="#{downloadBean.sayHello}"/>
>>>>>>     </tr:commandLink>
>>>>>>     </tr:form>
>>>>>> </f:view>
>>>>>>  </body>
>>>>>> regards
>>>>>> Oleg
>>>>>> 
>>>>>> Cédric Durmont wrote:
>>>>>>> 
>>>>>>> Ooops, looks like <tr:form> is missing...
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Cedric
>>>>>>> 
>>>>>>> 2011/6/15 jitechno <[email protected]>:
>>>>>>>> 
>>>>>>>> Hello,
>>>>>>>> I tried this example,
>>>>>>>> http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_fileDownloadActionListener.html
>>>>>>>> 
>>>>>>>> Not with commandLine, not with commandButton I am nat able to fire
>>>>>>>> file
>>>>>>>> save
>>>>>>>> dialog. No exceptions, no actions, nothing. Please, advice me, what
>>>>>>>> is
>>>>>>>> wrong
>>>>>>>> here?
>>>>>>>> Thanks in advance
>>>>>>>> 
>>>>>>>> <f:view>
>>>>>>>>          <h:commandButton value="Download"
>>>>>>>> styleClass="submit_button">
>>>>>>>>            <tr:fileDownloadActionListener
>>>>>>>> filename="#{downloadBean.fileName}"
>>>>>>>> 
>>>>>>>> contentType="#{downloadBean.contentType}"
>>>>>>>> 
>>>>>>>> method="#{downloadBean.sayHello}"/>
>>>>>>>>          </h:commandButton>
>>>>>>>> 
>>>>>>>>     <tr:commandLink text="Download file">
>>>>>>>>     <tr:fileDownloadActionListener
>>>>>>>>                              filename="hello.txt"
>>>>>>>>                              contentType="text/plain;
>>>>>>>> charset=utf-8"
>>>>>>>>                              method="#{downloadBean.sayHello}"/>
>>>>>>>>     </tr:commandLink>
>>>>>>>> </f:view>
>>>>>>>> ------------------------------------------------------------------
>>>>>>>> faces-config contains
>>>>>>>> <managed-bean>
>>>>>>>> <managed-bean-name>downloadBean</managed-bean-name>
>>>>>>>>      <managed-bean-class>Beans.DownloadBean</managed-bean-class>
>>>>>>>>      <managed-bean-scope>request</managed-bean-scope>
>>>>>>>>      <managed-property>
>>>>>>>>          <property-name>text</property-name>
>>>>>>>>          <value>Hi there!</value>
>>>>>>>>      </managed-property>
>>>>>>>>      <managed-property>
>>>>>>>>          <property-name>contentType</property-name>
>>>>>>>>          <value>text/plain; charset=utf-8</value>
>>>>>>>>      </managed-property>
>>>>>>>>      <managed-property>
>>>>>>>>          <property-name>fileName</property-name>
>>>>>>>>          <value>hello.txt</value>
>>>>>>>>      </managed-property>
>>>>>>>> </managed-bean>
>>>>>>>> --------------------------------------------------------------------------------------------
>>>>>>>> DownloadBean is here:
>>>>>>>> package Beans;
>>>>>>>> 
>>>>>>>> import java.io.IOException;
>>>>>>>> import java.io.OutputStream;
>>>>>>>> import java.io.OutputStreamWriter;
>>>>>>>> import javax.faces.context.FacesContext;
>>>>>>>> 
>>>>>>>> public class DownloadBean  implements java.io.Serializable{
>>>>>>>> 
>>>>>>>> public DownloadBean() {
>>>>>>>> }
>>>>>>>> private String text;
>>>>>>>> public void setText(String text){
>>>>>>>>   this.text = text;
>>>>>>>> }
>>>>>>>> public String getText(){
>>>>>>>>   return this.text;
>>>>>>>> }
>>>>>>>> 
>>>>>>>> private String fileName;
>>>>>>>> public void setFileName(String fileName){
>>>>>>>>   this.fileName = fileName;
>>>>>>>> }
>>>>>>>> public String getFileName(){
>>>>>>>>   return this.fileName;
>>>>>>>> }
>>>>>>>> private String contentType;
>>>>>>>> public void setContentType(String contentType){
>>>>>>>>   this.contentType = contentType;
>>>>>>>> }
>>>>>>>> public String getContentType(){
>>>>>>>>   return this.contentType;
>>>>>>>> }
>>>>>>>> public void sayHello(FacesContext context, OutputStream out) throws
>>>>>>>> IOException
>>>>>>>>  {
>>>>>>>>    System.out.println("sy Hello "+ getFileName()+"
>>>>>>>> "+getContentType());
>>>>>>>>    OutputStreamWriter w = new OutputStreamWriter(out, "UTF-8");
>>>>>>>>    w.write(getText());
>>>>>>>>    // The stream is automatically closed, but since we wrapped it,
>>>>>>>>    // we'd better flush our writer
>>>>>>>>    w.flush();
>>>>>>>>  }
>>>>>>>> }
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://old.nabble.com/What-is-wrong-with-Trinidad%27s-download-example--tp31851629p31851629.html
>>>>>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/What-is-wrong-with-Trinidad%27s-download-example--tp31851629p31858292.html
>>>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> -- 
> View this message in context: 
> http://old.nabble.com/What-is-wrong-with-Trinidad%27s-download-example--tp31851629p31869477.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> 

Reply via email to