what is web .config method

what is web .config method

servlet container what is difference between servlet container and servlet config?

Servlet container(sub set of web container) is the controller of the servlet.It creates the servlet,initializes,call the service method and finally destroy it.

Servlet config is an object.


what are the necessary conditions to override the init() in servlets? For overriding init()method any rules are there

There are no necessary conditions to override this particular method. In case you are overridding init(ServletConfig config), then make sure to call super.init(config).


Why servlet context is used but not ServletConfig what is use of the servletconfig

  1. ServletContext is used to hold information about the application. One object serve whole application. while Servletconfig hold the information about the servlet only. each servlet has its own servletconfig object.

2.ServletContex is used to hold information required through out application. One object created for per application and remain active until server is up. while servlet config is used to hold information specific to servlet only. object created one per serlvet and remain active as long as servlet is live.

3.The ServletContext is the way to comminucate with the whole application, and the servletconfig is to communicate just with the actual servlet... Greetings...


JSP server process Explain the server process how will server identifies that and response to corresponding servlet and how it sends to that response to correct user ?

After we request for a jsp. There is a servlet called pagecompilor , which first parses the .jsp page to .java page. then compiles that .java page and produces .class page.

EX.

if we have mypage.jsp

firse myPage-jsp.java then myPage_jsp.class then the source code of resultant JSP-servlet page would look like the fallowing

public myPage_jsp extends httpJspbase {

_jspService() {// what ever is coded in scriplet come here }

// you will not see any _init() or _destroy() methods here

if we look at the signature of httpJspBase

abstract httpJspBase extend httpServlet impliments httpJspPage


Servlets Questions 1)What is web.xml? 2)what is the filter? 3)How to we create a new JSTL class? 4)When we are developing the project which collections mostly used? 5)Difference between reqeust.getAttribute,and request.getParameter?

1)What is web.xml? web.xml is nothing but a deployment descriptor. It describes a web applicants deployment settings. 2)what is the filter? It is an Pluggable web componenet device it allow us to implement or add pre processing or post processing logic in our application. 3)How to we create a new JSTL class? 4)When we are developing the project which collections mostly used? 5)Difference between reqeust.getAttribute,and request.getParameter? getAttribute => Returns an Object, We can set an attribute getParameter => Returns a String, But no setters in parameter

1) What is web.xml?

As this is a deployment descriptor, this is mandatory for an web application to deploy in web/application server. It contains servlets name, url pattern, load on startup, if your application is using any 3rd party tools and if it needs any servlet of that to be initiated etc will be there.

4) When we are developing the project which collections mostly used?

List & Maps interfaces are used most with classes like ArrayList, TreeMap, LinkedHashMap and sometimes Collection.reverseOrder etc

5) Difference between reqeust.getAttribute,and request.getParameter?

Any form (page) data can be accesseed by getParameter() and which ever is set in jsp or servlet as setAttribute can be accessed with getAttribute()


What is the use of Service() in servlets? How is that method invoked?

The container initializes the servlet instance by calling the init .After completing the initialization it calls the service () method passing servlet request and response objects as parameters. service () method is designed in such a way the depending on type of the request method it calls the either doGet() or doPost() method. There is no need to make a explicit call to doGet () or doPost() method.


jsp

What information that the ServletResponse interface gives the servlet methods for replying to the client?

The information of buffer size, content length, content type and locale is provided to the client by the servletresponse interface.

What is the servlet life cycle?

Every servlet follows the same cycle

*The servlet is initialized by calling the init () method. *The servlet calls service() method to process a clients request. *The servlet is terminated by calling the destroy() method. *Finally, servlet is garbage collected by the garbage collector of the JVM.


JSP Comments What are the ways to write comments in the JSP page? Give example.

Every one know this very simple question best ans my side:-

Two types of comments are allowed in the Jsp page:

1) Hidden comment: This comment will not appear in the output

2) Output comment: This type of comment will appear in the output.

If we have to pass the comment inside the directive then there we use a single line comment i.e. //


advantage of jsp

JSP have all advatages of Java i.e write once run anywhere.JavaServer Pages (JSP) lets you separate the dynamic part of your pages from the static HTML. You simply write the regular HTML in the normal manner, using whatever Web-page-building tools you normally use. You then enclose the code for the dynamic parts in special tags, most of which start with "<%" and end with "%>".


how to disable expression language in jsp

We can use isEliIgnored property or we can disable by using below code..

Code *.jsp true


how to handal error in jsp

When ever Exception accoured redirect the cantrol to the Error page <%@ page ErrorPage="error.jsp" %> In Error page add the bellow line of code <%@ page isErrorPage="true" %> <% out.println(" "); PrintWriter pw=request.getWriter(); Exception.getPrintStakeTrace(pw); out.println(" "); %>

Transfer data in JSP How to transfer data over multiple pages?

It can be acheived if we store the data in session scope... using session.setAttribute("name",value);

It can be retrieved in another page by writing session.getAttribute("name"); 2.session 3.request. 4.application


redirect one page to another page

<% response.sendRedirect("RedirectIfSuccessful.html"); %>

<% String st=request.getParameter("n"); if(st==""){ getServletContext().getRequestDispatcher("/form.jsp").forward(request, response); } else{ getServletContext().getRequestDispatcher("/welcome.jsp").forward(request, response); }


what are the use of implicit objects in jsp?

1.Implicit objects let developers access container-provided services and resources. These objects are defined as implicit because you do not have to explicitly declare them. They are defined in every JSP page and used behind the scenes by the container whether you declare them or not -- although you cannot redeclare them. Because implicit objects are declared automatically, we need only use the reference variable associated with a given object to begin calling methods on it.Functional categories of implicit objects: * Session management: application, session, request, pageContext * Flow control: application, config, pageContext, request, session * Logging and exceptions: application, config, exception, pageContext, request, session * Input/output control: request, response, out * Initialization parameters: config

2.Little addition to JSP implicit Objects: Implicit Objects are 9:

request

response

page

application

session

pagecontext

exception

out

config

These simplify JSP code by providing ready state objects.

Ex: request.getElementById("xyz");

here you are using 'request' object without instantiating it because this object is readily available for you.


why we need web container to Deploy the servlet or jsp ?

Servlets and JSP are server side technologies and should be invoked when we receive request from client browser so web container will act as interface between client request and Servlets and jsp in other words Servlets and jsp will reside under web container in order to server client request. hence we required web container in order to invoke Servlets or jsp Read more at http://www.geekinterview.com/question_details/58434#fD5DJLqlSj4krjtz.99


Jasper Exception in JSP When and why jasperException occurs?

1.It is occurs whenever you miss the tags, or did not close tags properly, or if you put any condition like

int i=request.getparameter("value") if(i==null) { } at this time if i value shows null it gives a Jasper Exception

2.When you are JSP is not parsed by the jasper engine then it throw jasper Exception. Means If you are writing the jsp code not properly and if you put any unavailable resources in the jsp then we will get Jasper Exception


Can we use main method inside JSP? Why?

We can use main method in Jsp/servlet, but there is no use. This main() method will not execute throughout the life cycle. Then why should we need to use.

Generally these JSP/Servlets are server side technologies.These will be executed under webcontainer only. Webcontainer will execute JSP/servlet life cycle or callback methods only in order to execute JSP/Servlet.

So throughout the life cycle of JSP/Servlet, the webcontainer will execute init(ServletConfig),service(ServletRequest,ServletResponse),destroy() methods onl


what is jsp

1.sp is server-side technology,which combines both- application logic(java code) and presentation logic(HTML code),so that HTML designers and java code devlopers can work in tandom(simultaniously) by providing there max skills on the application,JSP's reduces javacode by introducing customtags moreover no recompilation problems when code needs to be modified.

2.JavaServer Pages. A server-side technology, JavaServer pages are an extension to the Java servlet technology that was developed by Sun. JSPs have dynamic scripting capability that works in tandem with HTML code, separating the page logic from the static elements -- the actual design and display of the page. Embedded in the HTML page, the Java source code and its extensions help make the HTML more functional, being used in dynamic database queries, for example. JSPs are not restricted to any specific platform or server.


response.sendredirct end the session first chek than believe


How do you use "synchronized" blocks? Is there other way to prevent next thread to access the resource with out using "synchronized" blocks?

you can use wait and notify methods

View Answers









Related Tutorials/Questions & Answers:
what is web .config method
what is web .config method  servlet container what is difference between servlet container and servlet config? Servlet container(sub set of web...,call the service method and finally destroy it. Servlet config is an object
What is an abstract method?
What is an abstract method?   Hi, What is an abstract method? thanks
Advertisements
What is a native method?
What is a native method?   Hi, What is a native method? thanks,   Hi, This Native mathod is a Java keyword that is used in method declarations to specify that the method will not be implemented in another language
What is the arguement of main method?
What is the arguement of main method?  hi, What is the arguement of main method? thanks,   Hi, For main() method accepts only an array of String object as arguement. For moe details on http://www.roseindia.net/java
what is ment by method signature in java.......
what is ment by method signature in java.......  what is ment by method signature in java.......   Hi Friend, The signature of a method is the combination of the method's name along with the number and types
What restrictions are placed on method overloading?
What restrictions are placed on method overloading?   Hi, What restrictions are placed on method overloading? thanks
What is the difference between a constructor and a method?
What is the difference between a constructor and a method?  Hi, What is the difference between a constructor and a method?   Hi, I have... and method
What is use of method overloading and overriding?
What is use of method overloading and overriding?  Method overriding means same method has written in both child and parent classes.overloading means write same method with different signatures.But I want to know what is the use
What is the return type of the main method?
What is the return type of the main method?  hi, What is the return type of the main method? thanks   Hi, In the java programming... to have a method named main in at least one class. The following is what must
What if the main() method is declared as private?
What if the main() method is declared as private?  Hi, What if the main() method is declared as private? Thanks   Hi, I have found some reference site for java programming coding for Main() method is declared
What is the access scope of a protected method?
What is the access scope of a protected method?  Hi, What is the access scope of a protected method? thanks   Hi, In Java program, A protected method can be accessed by the classes within the package
web method - IDE Questions
web method  I want to know details about enterprise application integration(eai)? I want the books available and how to code using eai?  Hi Friend, Please visit the following link: http://www.roseindia.net/eai
What is Web Development?
What is Web Development?  As a end user what arises in your mind. Like "What is Web development". Can any one explain with some examples. Thanks
What is Web hosting
What is Web hosting  What is web hosting services and how to host a website?   Hi, We hosting is process of hosting website on the Internet server so that users around the world can access your website from anywhere
What is the difference between GET and POST method?
What is the difference between GET and POST method?  In PHP, both GET and POST method serves the same feature to get the data in variable. Still... it in detail with the case where we can use GET and POST method in PHP.   
what is the use of Hibernate Sessionfactory close() method?
what is the use of Hibernate Sessionfactory close() method?  hi, What is the use of of Hibernate Sessionfactory close() method? Thanks..   Hello, Close() method of Hibernate Sessionfactory destroys the SessionFactory
What is the first argument of the String array in main() method?
What is the first argument of the String array in main() method?  Hi, What is the first argument of the String array in main() method? Thanks... array in very efficient manner. For details on What is the first argument
what is php used for in web design
what is php used for in web design  what is php used for in web design
What’s the difference between accessing a class method via -> and via ::?
What?s the difference between accessing a class method via -> and via ::?  What?s the difference between accessing a class method via -> and via
What are the restriction imposed on a static method or a static block of code?
What are the restriction imposed on a static method or a static block of code?  hi, What are the restriction imposed on a static method or a static block of code? Thanks
what does mean of method("1") in below struts.xml file
what does mean of method("1") in below struts.xml file  Hi, here is my code /register.jsp /register.jsp /success.jsp
Writing a web page to test drive each method in the web app
Writing a web page to test drive each method in the web app  I got an assignment in my university. I need to write a single web page, that lists all the classes in the particular web app. Selecting a class, the page should list
What is Web Hosting
What is Web Hosting?       What is Web Hosting? If you have a company and want web presence than you need a website. With the website any one from
What is web hosting,what is hosting,web hosting,web hosting companies,India,UK
What Is Web Hosting? Web hosting is a service provided by big companies to host the web site, the hosted site is accessible one the internet. In fact.... The companies providing the space on the internet is called Web Hosts or Web Hosting
how to override the hashCode() method ? and What is the advantage of overide the hashcode().
how to override the hashCode() method ? and What is the advantage of overide the hashcode().   send me code   It is not always necessary to override hashcode and equals. But if you think you need to override one
what is the difference between distributed application and web application?
what is the difference between distributed application and web application?  what is the difference between distributed application and web application
Web Hosting Guide, What is Web Hosting Plan?
Web Hosting Plan - What is Web Hosting Plan... will learn about Web Hosting plan and understand what is a web hosting plan? How... types of web hosting plan provided by the hosting company. Some plans are cheap
JAVA what is different between static block and public static void main(String a[]) method
JAVA what is different between static block and public static void main(String a[]) method  what is different between static block and public static void main(String a[]) method,we execute method without main method(by static
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?  Hello to all, I have searched the net to know that is there any equivalent method for clrscr
method
method  can you tell me how to write an abstract method called ucapan() for B2 class class A2{ void hello(){ system.out.println("hello from A2"); }} class B2 extends A2{ void hello(){ system.out.println("hello from B2
what is the difference betwen application server & web server - Java Interview Questions
what is the difference betwen application server & web server  what is the difference betwen application server & web server
Java web development, what skills do I need?
Java web development, what skills do I need?  Java web development, what skills do I need
Java web development, what skills do I need?
Java web development, what skills do I need?  Java web development, what skills do I need
What do I need to do to use a MSSQL-Server with Web-Harvester?
What do I need to do to use a MSSQL-Server with Web-Harvester?  What do I need to do to use a MSSQL-Server with Web-Harvester
What is the use of MySQL, MS SQL in Web Hosting paradigm?
What is the use of MySQL, MS SQL in Web Hosting paradigm?  I am.... For now I want to learn the things about MySQL, MS SQL in Web hosting. What... What is MySQL, MS SQL in Web Hosting. Thanks
What are Web Design Services
What are Web Design Services The term web design looks simple that refers to arranging contents and graphics on a single web page or a bunch of web pages that create websites
What is Web Graphics
What is Web Graphics Web graphics... of what they are looking for. Web graphics helps designers to enhance... that don’t have web graphics don’t appeal to visitors. Successes
SEO and Search Engines,Best Search Engines on Web,What is Search Engine
. is vital for any SEO. In this section we will compare important search engines. What... and it create the index of the web sites available on the internet. Anyone can visit... the pages from the web and storing into repository   
What is HTML web designing
What is HTML web designing Hypertext Mark-up Language (HTML) is the principal markup language for web... such as JavaScript that can affect the behavior of Web browsers and other HTML
JDBC Batch commit method Example
JDBC Batch commit method Example: In this example, you can learn what is setAutoCommit() method and commit() method in the jdbc batch processing and how it work?. The setAutoCommit() method used to set created connection auto commit
What is web hosting and its types
What is Web Hosting? This article is discussing about the Web Hosting and explains the features of web hosting. You will learn about the types of web... for hosting your website. What is Web Hosting? Web hosting is simply putting
Method
question arises that, "what is method invocation?". There are two type... Method       In this section, we will explore the concept of method in the reference of object oriented
Static method
Static method  what is a static method?   Have a look at the following link: Java Static Method
gc() method
gc() method  what is difference between java.lang.System class gc() method and java.lang.Runtime class gc() method
main method
main method  What is the argument type of a program's main() method
Checkbox method
Checkbox method  what is the method to check if the checkbox is checked
What is PHP?
What is PHP? In this section we will discuss about PHP and will try to understand "What is PHP?" and "Why it is used for web development..., destructions, and abstracts. PHP for Web Development:ADS_TO_REPLACE_2 The PHP
Method overriding
Method overriding  How compiler decide parent class'method or child class's method to call? What is the meaning of this: Parent obj=new child_obj
What is JSON?
What is JSON? In this article we are discussing about the JSON which stands for JavaScript Object Notation. It is widely used on the Internet for mainly transfer the data into text format very easily from server to the client

Ads