why include file can not modify the header and cookies.can tell the reason.

What are you referring to? typically the problem with include files is that the response buffer either contains data already or has been sent... you can't change what is buffered or sent but you can add to it... if the buffer is not sent then you can clear it, which erases it and allows you to start over... I always do a response.resetBuffer() prior to forwarding pages, for example, so that I am sure I can forward without trouble... it is also a goot idea to do a check to see if the buffer is comitted prior to clearing it... you can't clear if it is sent... of course... so doing so will throw an error...

Peace,

Again, perhaps I can help more if you provide more details about what you are trying to do...

Again, perhaps I can help more if you provide more details about what you are trying to do...

i have one page(main.jsp) ,another page (includepage.jsp)

main.jsp :

<%@ include file="includepage.jsp">

why include page cannot modify /set cookie or headers.

see my first post above... unfortunately for JSP the return characters at the end of each line are sent to the response buffer, so by the time you get to you include directive, you already have content in the response buffer... this can cause trouble... unless I am misunderstanding your problem... in which case I want to help, but you can't be stingy with the details...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.