You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Simon Kitching (JIRA)" <de...@myfaces.apache.org> on 2008/05/22 12:33:55 UTC

[jira] Commented: (TOMAHAWK-1258) not working attributes actionListener on the datatable ?? help me please

    [ https://issues.apache.org/jira/browse/TOMAHAWK-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598966#action_12598966 ] 

Simon Kitching commented on TOMAHAWK-1258:
------------------------------------------

This is a bug tracking system, not a help forum. Please subscribe to the user email list and post your question there.
I will delete this bug entry shortly...

> not  working  attributes actionListener  on the datatable  ?? help me please
> ----------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1258
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1258
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>         Environment: window xp , tomcat 5.0 , java 1.4 , eclipse tool 
>            Reporter: HasunJoung
>            Priority: Critical
>
> I usually use this tomahawk  Extended Datatable , But  I got a serious problem.
> <t:dataTable id="docuInfoList"
>  value="#{fistDocuMgmtPageBean.docuInfoList}" 
>  var="docuInfo" >
>      <t:column>
>         <f:facet name="header">
>               <t:outputText value="download"/>   
>         </f:facet>
>         <t:commandLink id="download" immediate="true" actionListener="#{docuMgmtPageBean.fileDownAction}" >
>               <t:graphicImage url="images/add.gif"  />
>         </t:commandLink>				 				 	 
>       </t:column>	
>   </t:dataTable>
> I tried commandButton.. but     attribute actionListener did not  function.. please help me..
> public void fileDownAction (ActionEvent event)  {
> 		String filename = "StatWR.xls"; 
> 		String defaultPath = "c:/work/"; 
> 		
> 		//HttpServletRequest request = (HttpServletRequest)getExternalContext().getRequest();
> 		HttpServletResponse response = (HttpServletResponse)getExternalContext().getResponse();
> 		
> 		response.setContentType("application/vnd.ms-excel; charset=UTF-8"); 	
> 		
> 		response.setHeader("Content-Disposition", "attachment; filename=" + filename);
> 		try {
> 		        response.setHeader("Content-Disposition","attachment; filename="+URLEncoder.encode(filename, "UTF-8"));
> 		} catch (UnsupportedEncodingException e1) {
> 		       e1.printStackTrace();
> 		}     
> 		
> 		File file = new File(defaultPath + filename); 
> 		byte[] bytestream = new byte[(int)file.length()]; 
> 		
> 		try{
> 		FileInputStream filestream = new FileInputStream(file); 
> 		int i = 0, j = 0; 
> 		
> 		while((i = filestream.read()) != -1) { 
> 			bytestream[j] = (byte)i; 
> 			j++; 
> 		} 
> 		OutputStream outStream = response.getOutputStream(); 
> 		outStream.write(bytestream); 
> 		outStream.close(); 
> 		}catch(Exception e) {
> 			e.printStackTrace();
> 		}
> 	}
>   I tried everything . And this Action function well not on the datatable..  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.