[jboss-user] [JBoss Seam] - Re: how to download a file via Seam& JSF,

dustismo do-not-reply at jboss.com
Wed Jan 23 18:05:42 EST 2008


The code I posted works fine for me..  Here is a working example.

Component:

  | @Name("testController")
  | @Scope(ScopeType.PAGE)
  | public class TestController {
  | 	public void hello() {
  | 		try {
  | 			FacesContext context = FacesContext.getCurrentInstance();
  | 			HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
  | 			response.setContentType("text/plain"); //fill in contentType 
  | 			OutputStream os = response.getOutputStream();
  | 			os.write("HELLO THERE".getBytes()); //fill in bytes
  | 			os.flush();
  | 			os.close();
  | 			context.responseComplete();
  | 		} catch (Exception x) {
  | 			x.printStackTrace();
  | 		}
  | 	}
  | }
  | 

View:


  | 
  | <ui:composition xmlns="http://www.w3.org/1999/xhtml"
  |                 xmlns:s="http://jboss.com/products/seam/taglib"
  |                 xmlns:ui="http://java.sun.com/jsf/facelets"
  | 		template="templates/template.xhtml"
  |                >
  | 		<s:button action="#{testController.hello}" value="test"/>
  | 	
  | </ui:composition>
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4122839#4122839

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4122839



More information about the jboss-user mailing list