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.