what is web.xml?and its use?
Answers were Sorted based on User's Feedback
Answer / shankar reddy
The web.xml file provides configuration and deployment
information for the Web components that comprise a Web
application. Examples of Web components are servlet
parameters, servlet and JavaServer Pages (JSP) definitions,
and Uniform Resource Locators (URL) mappings.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / deepa vg
The web.xml is called the deployment descriptor. It is used
to provide details about the deployment of the web
application.
At a very minimum, it tells the servlet container the
version of the servlet specifications to use for the app.
Additionally, since you are using servlets, you have to use
it to provide details about the class of your servlets, and
the URL to use for mapping HTTP requests to the servlet.
You also can specify security roles and limited access for
pages, define attributes to store application-wide, define
specific pieces of information for JSPs, define MIME-Type-
Mappings, Welcome Page file names, and other details about
the Servlet Context.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / shiva
web.xml is useful to map the url pattern given by the client
to the appropriate servlet. This is the main purpose of the
web.xml.
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / dsr
web.xml is the mapping of servlet pages and context
parameters and configuration files.
It is used for access the web-based application of
perticular servlet.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / dipesh
It is place where we declare instead of hard coding any
thing ..it is read by our container for like where to route
the request ,security roles,error-pages class name etc
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / sathish s t
web.xml file is the configuration file for your web application project ,each web application project should have this file and don't give another name instead of web.xml(default)
uses:
After the server(tomcat) get the request from the user, that ask the servletcontainer, where to find the servlet.The servletcontainer tells to tomcat, to go web.xml configuration file.In this file the servlet-mapping element gets the URL from the tomcat and maps the corresponding servelt.Then the tomcat take that servlet and gives response to user.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / harikumar
web.xml is used specify the name of our servlet
class,servlet name & url-pattern to the server.
Then onle server can identify our class after calling from
the browser defined in servlet mapping tag inside the
web.xml.
web.xml is used to map our application.
| Is This Answer Correct ? | 1 Yes | 2 No |
The following program reads data (details of students) from a file named students.txt and converts it into e-mail addresses. The results are written to a file named studentemail.txt. students.txt consists of a number of lines, each containing the data of a student in colon delimited format: Last Name:First Name:Student Number Each input record is converted to an e-mail address and written to studentemail.txt in the following format: the first character of the last name + the first character of the first name + the last four digits of the student number + “@myunisa.ac.za” import java.io.*; public class EmailConverter { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new FileReader ("students.txt")); PrintWriter output = new PrintWriter(new FileWriter ("studentemail.txt")); String line = input.readLine(); while (line != null) { // Extract the information for each student String[] items = line.split(":"); // Generate the email address String email = "" + items[0].charAt(0) + items[1].charAt(0) + items[2].substring(4,8) + "@myunisa.ac.za"; email = email.toLowerCase(); // Output output.println(email); line = input.readLine(); } input.close(); output.close(); } } Rewrite the class so that it handles possible errors that may occur. In particular, it should do the following: • It should catch at least three appropriate exceptions that might occur, and display suitable messages. • At this stage, the program will not run correctly if there is an empty line in the input file. Change the program so that if an empty line is encountered, an exception is thrown and the empty line is ignored. This exception should be handled with the display of a suitable error message. • Before the e-mail address is added to the output file, check if the student number has 8 digits. If not, throw an InvalidFormatException (which the program should not handle itself)
What is the public method modifier?
Which of these methods belong to Thread & Object class? join, yield, sleep, wait, notify
What is the purpose of sizeof operator?
Explain the difference between jvm and jre?
What is the use of static class?
What is pre increment and post increment in java?
What are the OOPS concepts in Java ?
What does those terms actually mean included in the j.d.k i.6?
What are the new features in java 8? Explain
Is it possible to use string in the switch case?
can abstract class have constructor how can you achive this ?