I am new to java servlets. I studied some code about servlet but I really want to know more basic things and how it works. I just wonder what type of material/content can be sent from java servlet to a browser. Like http request or something? And how does brower know how to deal with this material? In addtion, for java bean. I know it is a java class. But, what is the purpose behind the development of the java bean concept.
Share
What type of material/content can be sent from java servlet to a browser?
A servlet can return any kind of data to the browser (or whatever else made the request). The data is wrapped in a
ServletResponseobject, usually aHttpServletResponse.The response contains both the actual data and also meta data in the form of response headers, although we are now moving into the realm of HTTP, rather than servlets. You know how HTTP works, right? Yo
How does brower know how to deal with this material?
The response headers typically hint to the browser what type of data the response is, whether it is text, html, XML, etc. This is given by the response header called Content-Type. Again this is standard HTTP stuff, not really specific to servlets.
What is the purpose behind the development of the java bean concept?
The java bean standard is a convention used for writing POJOs. There are many tools that are specifically designed to work with classes written to the java bean standard. In relation to servlets and HTTP, the best example is probably JSTL, which allows you to access objects in a JSP so long as they follow the bean standard.