Java JSB Servlets Question and Answers

53. What is expression in JSP?
  Expression tag is used to insert Java values directly into the output. Syntax for the Expression tag is
<% = expression %>
An expression tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. The following expression tag displays time on the output:<%=new java.util.Date () %>
 
Your Name Your Email-ID
Your Answer
54. Differentiate between doGet and doPost method.
  doGet is used when there is a requirement of sending data appended to a query string in the URL. The doGet models the GET method of Http and it is used to retrieve the info on the client from some server as a request to it. The doGet cannot be used to send too much info appended as a query stream. GET puts the form values into the URL string. GET is limited to about 256 characters (Usually a browser limitation) and creates really ugly URLs.
POST allows you to have extremely dense forms and pass that to the server without cluster or limitation in size. E.g. you obviously can't send a file from the client to the server via GET. POST has no limit on the amount of data you can send and because the data does not show up on the URL you can send passwords. But this does not mean that POST is truly secure. For real security you have to look into encryption which is an entirely different topic.
 
Your Name Your Email-ID
Your Answer
55. What do you understand by Context Initialization Parameters?
  The context param element contains the declaration of a web applications servlet context initialization parameters.
<context-param>
<param-name>name</param-name>
<param-value>value</param-value>
</context-param>
The Context Parameters page lets you manage parameters that are accessed through the ServletContext.getInitParameterNames and ServletContext.getInitParameter methods.
 
Your Name Your Email-ID
Your Answer
123456789101112131415


Page 14 of 15