You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Bolsover <ju...@bolsover.com> on 2003/05/19 21:38:01 UTC

RE: Setting response headers in tiles - jayout.jsp

Yes -

I understand the point about not setting the content type (or other headers)
once you have committed the response. - My question is only partially to do
with tiles - does tiles assemble the whole page and then send the
response? - if so, I should be able to set the content type in a scriptlet
in the layout page shouldn't I?  Or, does tiles in some way commit the
response before assembling and sending the tiles? - In which case any
attempt to set headers (in scriptlets) in the layout.jsp is doomed to
failure.  Also, would it help to set the page buffer size to somthing larger
than any (excel) response? - so that the page (and any headers being set) is
buffered by the server before being sent to the client.

Other question is about how to avoid rewiting all my tiles so that they can
be used by an excel enabled client.



-----Original Message-----
From: Cedric Dumoulin [mailto:cedric@apache.org]
Sent: 16 May 2003 16:45
To: Struts Users Mailing List
Subject: Re: Setting response headers in tiles




David Bolsover wrote:

>Hi
>
>I have a struts based  application with some 30 pages; each page is made up
>of 4 tiles header, menu, body, footer.
>
>I now need to implement some additional functionality - the user can
>optionally select to display the response in Excel :-(.
>
>This presents two issues:
>
>1 for the Excel response I just need a (new window) page made up of header,
>body, footer tiles, excluding the menu - advice on how best to achieve this
>please. - I don't fancy the idea of having to define lots of new
(tile)pages
>and rewriting my action classes to conditionally redirect the response.
>
>2 For the Excel response, explicitly setting
>response.setContentType("application/vnd.ms-excel") in my Action classes
>seems not to work, nor does setting this (in a scriptlet) in my layout.jsp.
>Is this an issue with tiles?  Again, advice on how to solve problem please.
>
  The jsp spec says that you can set the content type as long as you
haven't writen in the output.
  Practically, you can't set the content type from a tile if you have
already writen something in the response.

     Cedric

>
>David
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Setting response headers in tiles - jayout.jsp

Posted by David Bolsover <ju...@bolsover.com>.
Cedric

Thanks for the clarification; I'll do some tests.. adn let you know how I
get on.

Thanks

David

-----Original Message-----
From: Cedric Dumoulin [mailto:cedric@apache.org]
Sent: 20 May 2003 09:42
To: Struts Users Mailing List
Subject: Re: Setting response headers in tiles - jayout.jsp




David Bolsover wrote:

>Yes -
>
>I understand the point about not setting the content type (or other
headers)
>once you have committed the response. - My question is only partially to do
>with tiles - does tiles assemble the whole page and then send the
>response? -
>
  In practice, you should be able to change the request type in the
first tile reached, which is generally the layout tile.
  The Tiles framework assemble the page 'on the fly". When the request
arrive on the server, it follow its normal way. When it reaches a tiles
tag like <insert>, a RequestDispatcher.include() is performed. The
include can have the side effect of flushing and committing the
response. But, the first tile (the layout) is reached by performing some
forward instead of include. Forwards can be done as long as nothing is
written in the output. So, it can be used as long as we haven't reach a
tile. After that, we should use include.

   Cedric

>if so, I should be able to set the content type in a scriptlet
>in the layout page shouldn't I?  Or, does tiles in some way commit the
>response before assembling and sending the tiles? - In which case any
>attempt to set headers (in scriptlets) in the layout.jsp is doomed to
>failure.  Also, would it help to set the page buffer size to somthing
larger
>than any (excel) response? - so that the page (and any headers being set)
is
>buffered by the server before being sent to the client.
>
>Other question is about how to avoid rewiting all my tiles so that they can
>be used by an excel enabled client.
>
>
>
>-----Original Message-----
>From: Cedric Dumoulin [mailto:cedric@apache.org]
>Sent: 16 May 2003 16:45
>To: Struts Users Mailing List
>Subject: Re: Setting response headers in tiles
>
>
>
>
>David Bolsover wrote:
>
>
>
>>Hi
>>
>>I have a struts based  application with some 30 pages; each page is made
up
>>of 4 tiles header, menu, body, footer.
>>
>>I now need to implement some additional functionality - the user can
>>optionally select to display the response in Excel :-(.
>>
>>This presents two issues:
>>
>>1 for the Excel response I just need a (new window) page made up of
header,
>>body, footer tiles, excluding the menu - advice on how best to achieve
this
>>please. - I don't fancy the idea of having to define lots of new
>>
>>
>(tile)pages
>
>
>>and rewriting my action classes to conditionally redirect the response.
>>
>>2 For the Excel response, explicitly setting
>>response.setContentType("application/vnd.ms-excel") in my Action classes
>>seems not to work, nor does setting this (in a scriptlet) in my
layout.jsp.
>>Is this an issue with tiles?  Again, advice on how to solve problem
please.
>>
>>
>>
>  The jsp spec says that you can set the content type as long as you
>haven't writen in the output.
>  Practically, you can't set the content type from a tile if you have
>already writen something in the response.
>
>     Cedric
>
>
>
>>David
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>
>>
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Setting response headers in tiles - jayout.jsp

Posted by Cedric Dumoulin <ce...@apache.org>.

David Bolsover wrote:

>Yes -
>
>I understand the point about not setting the content type (or other headers)
>once you have committed the response. - My question is only partially to do
>with tiles - does tiles assemble the whole page and then send the
>response? - 
>
  In practice, you should be able to change the request type in the 
first tile reached, which is generally the layout tile.
  The Tiles framework assemble the page 'on the fly". When the request 
arrive on the server, it follow its normal way. When it reaches a tiles 
tag like <insert>, a RequestDispatcher.include() is performed. The 
include can have the side effect of flushing and committing the 
response. But, the first tile (the layout) is reached by performing some 
forward instead of include. Forwards can be done as long as nothing is 
written in the output. So, it can be used as long as we haven't reach a 
tile. After that, we should use include.

   Cedric

>if so, I should be able to set the content type in a scriptlet
>in the layout page shouldn't I?  Or, does tiles in some way commit the
>response before assembling and sending the tiles? - In which case any
>attempt to set headers (in scriptlets) in the layout.jsp is doomed to
>failure.  Also, would it help to set the page buffer size to somthing larger
>than any (excel) response? - so that the page (and any headers being set) is
>buffered by the server before being sent to the client.
>
>Other question is about how to avoid rewiting all my tiles so that they can
>be used by an excel enabled client.
>
>
>
>-----Original Message-----
>From: Cedric Dumoulin [mailto:cedric@apache.org]
>Sent: 16 May 2003 16:45
>To: Struts Users Mailing List
>Subject: Re: Setting response headers in tiles
>
>
>
>
>David Bolsover wrote:
>
>  
>
>>Hi
>>
>>I have a struts based  application with some 30 pages; each page is made up
>>of 4 tiles header, menu, body, footer.
>>
>>I now need to implement some additional functionality - the user can
>>optionally select to display the response in Excel :-(.
>>
>>This presents two issues:
>>
>>1 for the Excel response I just need a (new window) page made up of header,
>>body, footer tiles, excluding the menu - advice on how best to achieve this
>>please. - I don't fancy the idea of having to define lots of new
>>    
>>
>(tile)pages
>  
>
>>and rewriting my action classes to conditionally redirect the response.
>>
>>2 For the Excel response, explicitly setting
>>response.setContentType("application/vnd.ms-excel") in my Action classes
>>seems not to work, nor does setting this (in a scriptlet) in my layout.jsp.
>>Is this an issue with tiles?  Again, advice on how to solve problem please.
>>
>>    
>>
>  The jsp spec says that you can set the content type as long as you
>haven't writen in the output.
>  Practically, you can't set the content type from a tile if you have
>already writen something in the response.
>
>     Cedric
>
>  
>
>>David
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org