outputStream.close();
outputStream.flush();
facesContext.responseComplete();
facesContext.getApplication ().getStateManager().saveSerializedView(facesContext);
I hope it works...
regards...
On 5/4/06, Le Van <
[EMAIL PROTECTED]> wrote:
I did it before but the problem still occur. So do u think the reason is
JSF or I get wrong somewhere ?. I checked my code. Uhm...I'm not sure all.
Do you have any idea more ??
Murat Hazer wrote:
> add this line just before facesContext.responseComplete()
>
> facesContext.getApplication ().getStateManager().saveSerializedView(
> facesContext);
>
> regards...
>
> On 5/4/06, *Le Van* <[EMAIL PROTECTED] <mailto: [EMAIL PROTECTED]>>
> wrote:
>
> Hi all,
> I got a problem with t:commandButton. I have Search screen.
> First, I push Search button to get data from DB. Then I push
> OutputCSV button to get data results as csv file. Everything is
> OK.Now I push search again, but action is not been called for all
> command button on the screen ( except h:commandLink can take an
> action). Here is my code to get data as csv.
> public String outputCSVAction() {
> FacesContext facesContext =
> FacesContext.getCurrentInstance();
> HttpServletResponse response =
> (HttpServletResponse) facesContext.getExternalContext().getResponse();
> ByteArrayOutputStream arrayOutputStream = new
> ByteArrayOutputStream();
> List dataList = pageObject.getDataList();
> for (Iterator iter = dataList.iterator();
> iter.hasNext();) {
> TM00403ItemRow element = (TM00403ItemRow)
> iter.next ();
> prepareCSV(element, arrayOutputStream);
> }
> response.setContentType("application/x-download;
> charset=shift_jis");
>
> response.setHeader("Content-disposition","attachment; filename=\""
> + TMCommonConstants.OUTPUT_CSV + "\"");
> ServletOutputStream outputStream =
> response.getOutputStream();
> outputStream.write(arrayOutputStream.toByteArray());
> response.setContentLength(arrayOutputStream.size());
> outputStream.flush();
> outputStream.close();
> facesContext.responseComplete();
> }
> Could anyone help me ?
> Thanks for advance,
> Van Le
>
>
>
>
> --
> Murat HAZER
> Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer
> Tel - Phone: +90 222 335 05 80 - 1395
> Cep Tel - Mobile Phone: +90 532 472 00 63
> Blog URL: http://www.projedunyasi.org
> Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/
--
Murat HAZER
Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer
Tel - Phone: +90 222 335 05 80 - 1395
Cep Tel - Mobile Phone: +90 532 472 00 63
Blog URL: http://www.projedunyasi.org
Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/

