dcsimg
how to implement "send request, but no new html generation"
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   zhao_escort
Posted On:   Friday, June 14, 2002 02:08 AM

hello, i am new to JSP. I use javabean in JSP to record the table information user input, each the user change a column table value, i would like to save the update to the javabean . but i don't want a new html generated, since it's just the same page user see now, (but to save to javabean, submit is necessary), it seems that there will have to be a answer to the request, (rightly i use hidden frame to solve the question, so user don't see the fresh, is there any other good solutions? ) if not, i would like to know how to forward the request the top frame receives to a child frame. (the current solution uses two frames, one is hidden, the other is displayed. since now the request goes to the top frame, but the display frame(child frame) needs to han   More>>

hello, i am new to JSP.
I use javabean in JSP to record the table information user input, each the user change a column table value, i would like to save the update to the javabean . but i don't want a new html generated, since it's just the same page user see now, (but to save to javabean, submit is necessary), it seems that there will have to be a answer to the request, (rightly i use hidden frame to solve the question, so user don't see the fresh, is there any other good solutions? ) if not, i would like to know how to forward the request the top frame receives to a child frame.
(the current solution uses two frames, one is hidden, the other is displayed. since now the request goes to the top frame, but the display frame(child frame) needs to handle the request).

   <<Less

Re: how to implement "send request, but no new html generation"

Posted By:   michael_dean  
Posted On:   Saturday, June 15, 2002 11:19 PM

Just send back a status code of 204 (No Content). For example,:




<%
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
%>


It's meant to indicate that the request was received, processed successfully (it's between 200 and 299), and there is no new content but possibly some new meta information (i.e. header information). The browser is not allowed to change the document view. I know for a fact that Mozilla (and, therefore, Netscape 6+) are compliant with the specification in handling 204's, but other browsers may not handle the response correctly.



From the HTTP Specification (RFC 2616):





10.2.5 204 No Content




The server has fulfilled the request but does not need to return an
entity-body, and might want to return updated metainformation. The
response MAY include new or updated metainformation in the form of
entity-headers, which if present SHOULD be associated with the
requested variant.



If the client is a user agent, it SHOULD NOT change its document view
from that which caused the request to be sent. This response is
primarily intended to allow input for actions to take place without
causing a change to the user agent's active document view, although
any new or updated metainformation SHOULD be applied to the document
currently in the user agent's active view.



The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields.


Re: how to implement "send request, but no new html generation"

Posted By:   Lasse_Koskela  
Posted On:   Friday, June 14, 2002 02:49 AM

You might find an answer from the HTTP specification: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.


Basically, the only possible solution is to pass a header ( HttpServletResponse.setHeader(String, String) ), which tells the client (browser) not to do anything. I do not know whether the browsers support this kind of headers but I'll let you find out...

About | Sitemap | Contact