Spring framework interview questions is in rise on J2EE and core Java interviews, As Spring is the best framework available for Java application development and now Spring IOC container and Spring MVC framework are used as de-facto framework for all new Java development. With this popularity interview questions from spring framework is top on any list of core Java Interview questions. I thought to put together some spring interview questions and answers which has appeared on many Java and J2EE interviews and useful for practicing before appearing on any Java Job interview. This list of Spring interview questions and answers contains questions from Spring fundamentals e.g. Spring IOC and dependency Injection, Spring MVC framework, Spring Security, Spring AOP etc, because of length of this post I haven't included Spring interview questions from Spring JDBC and JMS which is also a popular topic in core Java and J2EE interviews. I suggest to prepare those as well. Any way these Spring questions are not very difficult and based on fundamentals e.g. What is default scope of Spring bean and mostly asked during first round or telephonic round of Java interview. Although you can find answers of these Spring interview questions by doing Google but I have also included some answers for quick reference. As I said Spring and Spring MVC is fantastic Java framework and if you are not using it than start using it, these questions will give you some head start as well.
Showing posts with label jsp-servlet. Show all posts
Showing posts with label jsp-servlet. Show all posts
Thursday 29 August 2013
Top Most Top 10 Spring Interview Questions Answers J2EE
Labels:
core java interview question,
jsp-servlet,
spring
Wednesday 28 August 2013
Top Most Top 10 Servlet Interview Question Answers - J2EE
This time its servlet interview questions, I was thinking what to pick for my interview series and than I thought about J2EE and Servlet is my favorite on that space. Servlet is an important part of any J2EE development and serves as Controller on many web mvc frameworks and that’s why it’s quite popular on J2EE interviews. These Servlet questions are based on my experience as well as collected by friends and colleague and they are not only good for interview practice but also shows a new direction of learning for any one who is not very familiar with servlet technology.
As said earlier this interview question article is part of my earlier series java interview questions , UNIX command interview questions and Java threading interview questions.
You can find answers of all these questions on google but I have also listed my answers fo r quick reference.
Servlet Questions Asked in Interview
Question 1: In web.xml file <load-on-startup>1</load-on-startup> is defined between <servlet></servlet> tag what does it means.
Ans: whenever we request for any servlet the servlet container will initialize the servlet and load it which is defined in our config file called web.xml by default it will not initialize when our context is loaded .defining like this <load-on-startup>1</load-on-startup> is also known as pre initialization of servlet means now the servlet for which we have define this tag has been initialized in starting when context is loaded before getting any request.When this servlet question was asked to me in an interview few years back , I was not even aware of this element but this questions pointed me to look DTD of web.xml and understand other elements as well..
Ans: one simple way to call doPost() method inside doGet() and doGet()method inside doPost() it will create deadlock situation for a servlet. This is rather simple servlet interview questions but yet tricky if you don’t think of it J
Question 3: For initializing a servlet can we use constructor in place of init ().
Ans: No, we can not use constructor for initializing a servlet because for initialization we need an object of servletConfig using this object we get all the parameter which are defined in deployment descriptor for initializing a servlet and in servlet class we have only default constructor according to older version of java so if we want to pass a
Config object we don’t have parametrized constructor and apart from this servlet is loaded and initialized by container so ots a job of container to call the method according to servlet specification they have lifecycle method so init() method is called firstly.
More important Java doesn't allow interfaces to declare constructors. These kinds of servlet interview questions are quite popular on service based companies who just want to dig one level more.
Question 4: Why super.init (config) wiil be the first statement inside init(config) method.
Ans: This will be the first statement if we are overriding the init(config ) method by this way we will store the config object for future reference and we can use by getServletConfig () to get information about config object if will not do this config object will be lost and we have only one way to get config object because servlet pass config object only in init method . Without doing this if we call the servletConfig method will get NullPointerException.
Question5: Can we call destroy() method inside the init() method is yes what will happen?
Ans:Yes we can call like this but if we have not override this method container will call the default method and nothing will happen.after calling this if any we have override the method then the code written inside is executed.
Question 6: How can we refresh servlet on client and server side automatically?
Ans: On client side we can use Meta http refresh and server side we can use server push.
Question 7: How can you get the information about one servlet context in another servlet?
Ans: In context object we can set the attribute which we want on another servlet and we can get that attribute using their name on another servlet.
Context.setAttribute (“name”,” value”)
Context.getAttribute (“name”)
Question 8: Why we need to implement Single Thread model in case of Servlet.
Ans: In J2EE we can implement our servlet on two different ways either by using:
1. Single Thread Model
2. Multithread Model
Depending upon our scenario, if we have implemented single thread means only one instance is going handle one request at a time no two thread will concurrently execute service method of servlet.
Example in banking account where sensitive data is handle mostly this scenario was used this interface is deprecated in Servlet API version 2.4.
As the name signifies multi thread means a servlet is capable to handle multiple requests at same time. This servlet interview question was quite popular few years back on entry level but now its loosing its shine.
Question 9: what is servlet collaboration?
Ans communication between two servlet is called servlet collaboration which is achieved by 3 ways.
1. RequestDispatchers include () and forward() method .
2. Using sendRedirect()method of Response object.
3. Using servlet Context methods
Question 10: What is the difference between ServletConfig and ServletContext?
Ans: ServletConfig as the name implies provide the information about configuration of a servlet which is defined inside the web.xml file or we can say deployment descriptor.its a specific object for each servlet.
ServletContext is application specific object which is shared by all the servlet belongs to one application in one JVM .this is single object which represent our application and all the servlet access application specific data using this object.servlet also use their method to communicate with container.
These Servlet interview questions are good for quick recap of important concept before appearing on any J2EE interview. Please share if you have come across any other interesting interview question on Servlets.
Related Java tutorials
Labels:
core java interview question,
jsp-servlet
Sunday 25 August 2013
Top Most How to define Error page in Java Web Application - Servlet JSP
There are two ways to define Error page in Java web application written using Servlet and JSP. First way is page wise error page which is defined on each jsp page and if there is any unhanded exception thrown from that page, corresponding error page will be displayed. Second approach is an application wide general or default error page which is shown if any Exception is thrown from any Servlet or JSP and there is no page specific error page defined.
In this java tutorial we will see both approach to declare error page in JSP and when should we use page specific error page and when should we choose generate default application wide error page in Java web application. This is in continuation of my earlier post on Servlet and JSP like top 10 Servlet interview questions and top 10 JSP interview questions.
Labels:
jsp-servlet
Top Most How to change Tomcat default port 8080
Tomcat default port is 8080 but many times other Java application also uses 8080 like any other web-server Resin or Jetty and starting tomcat may result in java.net.BindException:Address already in use: JVM_Bind 8080. In order to avoid this exception you can change default port of tomcat from 8080 to some other port e.g. 8081 or 8082. Though don't change to tomcat port which is likely to be used by tomcat itself e.g. 8443 is used by tomcat https port. Use port which is most likely to be free. In this tomcat tutorial we will see how to change default port 8080 for http protocol in tomcat and port 8443 port for https protocol in tomcat.
Labels:
jsp-servlet
Friday 23 August 2013
Top Most Top 10 Struts Interview Question And Answer - J2EE
This time its Struts interview questions, After writing Spring interview questions few weeks back I was thinking what to pick for my interview series and than I thought about any web framework, and on that struts is my favorite. Struts are open source framework used for web application. These Struts interview questions are based on my experience as well as collected by friends and colleague and they are not only good for interview practice but also shows a new direction of learning for any one who is not very familiar with struts. Best way to use these interview questions is do revise before going for any Struts interview or any Java or J2EE interview. I have also provided answers of these struts interview questions but you can also research more on Google but these answers of struts are sufficient on interview perspective.
Labels:
core java interview question,
jsp-servlet
Thursday 22 August 2013
Top Most Spring Security Example Tutorial - How to limit number of User Session in Java J2EE
Spring security can limit number of session a user can have. If you are developing web application specially secure web application in Java J2EE then you must have come up with requirement similar to online banking portals have e.g. only one session per user at a time or no concurrent session per user. You can also implement this functionality without using spring security but with Spring security its just piece of cake with coffee :). Spring Security provides lots of Out of Box functionality a secure enterprise or web application needed like authentication, authorization, session management, password encoding, secure access, session timeout etc. In our spring security example we have seen how to do LDAP Authentication in Active directory using spring security and in this spring security example we will see how to limit number of session user can have in Java web application or restricting concurrent user session.
Read more »
Labels:
jsp-servlet,
spring
Top Most What is Bean scope in Spring MVC framework with Example
Bean scope in Spring framework or Spring MVC are scope for a bean managed by Spring IOC container. As we know that Spring is a framework which is based on Dependency Injection and Inversion of Control and provides bean management facilities to Java application. In Spring managed environment bean (Java Classes) are created and wired by Spring framework. Spring allows you to define how those beans will be created and scope of bean is one of those details. This Spring tutorial is next on my earlier post on Spring like how to implement LDAP authentication using Spring security and How to limit number of user session in web application, if you haven’t read them already you may find them useful.
Read more »
In spring framework bean declared in ApplicationContext.xml can reside in five scopes:
1) Singleton (default scope)
2) prototype
3) request
4) session
5) global-session
Labels:
core java interview question,
jsp-servlet,
spring
Wednesday 21 August 2013
Top Most JSTL set tag or <c:set> examples in JSP – Java J2EE Tutorial
JSTL set tag or <c:set> also called as JSTL Core tag library is a good replacement of <jsp:setProperty> jsp action which lacks lot of functionality and only allow you to set bean property. you can not set Map's key value or create a scoped variable by using <jsp:setProperty>. jstl <set> tag allows you to do all the stuff related to setting or creating variables or attributes. by using JSTL <c:set> tag you can :
Read more »
Labels:
jsp-servlet
Top Most Display Tag Export Example in JSP – Issue Fix Java Tutorial
Display tag provides export options to export page into PDF, CSV, Excel and XML in Java web application written using JSP, Servlet, Struts or Spring MVC framework. Display tag is a tag library and you just need to use it in your JSP page to display tabular data or generate HTML tables dynamically. Earlier we have seen 10 display tag tips for getting most out of display tag and in this JSP Servlet tutorial we will see one display tag export issue, which prevent display tag export functionality to work properly. Display tag experience is considered good in various JSP Interview and some questions related to sorting, paging, both internal paging and external paging and exporting on display tag also appear as various J2EE and Servlet Interview questions. In my opinion, after JSTL core tag library, display tag is most popular tag library and every Servlet and JSP developer should familiar with display tag.
Labels:
J2EE,
jsp-servlet,
programming
Top Most 10 examples of displaytag in JSP, Struts and Spring
Display tag is one of the best free open source library for showing data in tabular format in a J2EE application using jsp, struts or spring. it is shipped as tag library so you can just include this in your jsp and add corresponding jar and there dependency in class-path and you are ready to use it. Display tag is my favorite solution for displaying any tabular data because of its inherent capability on paging and sorting. It provides great support for pagination by its own but it also allows you to implement your own pagination solution. On Sorting front you can sort your data based on any column, implement default sorting etc.
There is so much resource available on using display tag including examples, demos and guides. In this article we will see some important points to note while using display tag in jsp. Though this library is very stable and rich in functionality still there are some subtle things which matters and if you don't know you could potentially waste hours to fix those things. These are the points I found out while I was using displaytag in my project and I have listed those down here for benefits of all.
I have outlined all the examples based upon task I had to perform and due to those tasks I discovered and get myself familiar with displaytag. It’s my personal opinion that task based approach works better in terms of understanding something than feature based. It’s simply easy for mind to understand problem first and then solution.
1) Provide UID while using two tables in one page.
In many scenarios we need to show two separate tables in one jsp page. We can do this by using two tag easily but the catch is that sorting will not work as expected. When you sort one table, second table will automatically sort or vice-versa. To make two tables independent of each other for functionality like exporting and sorting you need to provide "uid" attribute to table tag as shown below. I accidentally found this when I encounter sorting issue on display tag.
<displaytag:table name="listofStocks" id="current_row" export="true" uid="1">
<displaytag:table name="listofStockExchanges" id="current_row" export="true" uid="2">
just make sure "uid" should be different for each table.
<displaytag:table name="listofStockExchanges" id="current_row" export="true" uid="2">
just make sure "uid" should be different for each table.
2) Displaytag paging request starts with "d-"
There was bug in one of our jsp which shows data using displatag, with each paging request it was reloading data which was making it slow. Then we thought to filter out displaytag paging request and upon looking the pattern of displaytag paging request we found that it always starts with "d-", so by using this information you can filter out display tags paging request. Since we were using spring it was even easier as shown in below
Example:
Map stockParamMap = WebUtils.getParametersStartingWith(request, "d-");
if(stockParamMap.size() !=0){
out.println("This request is displaytag pagination request");
}
3) Getting reference of current row in displaytag
Many times we require reference of current row while rendering display tag data into jsp page. In our case we need to get something from currentRow and then get Something from another Map whose key was value retrieved from current row, to implement this of course we some how need reference of current row in display tag. After looking online and displaytag.org we found that by using "id" attribute we can make current row reference available in pageScope. Name of variable would be the value of "id" attribute, this would be much clear by seeing below example:
<displaytag:table name="pennyStocks" id="current_penny_stock" export="true" uid="1">
<di:column title="Stock Price" value="${pennyStockPrice[current_penny_stock.RIC]}" sortable="true" />
This way we are displaying stock price from pennyStockPrice Map whose key was RIC(Reuters Information Code) of penny Stock. You see name of variable used to refer current row is "current_penny_stock"
4) Formatting date in displaytag in JSP
Formatting date and numbers are extremely easy in display tag, you just need to specify a "format" attribute with <displaytag:column> tag and value of this tag would be date format as we used in SimpleDateFormat in Java. In Below example I am showing date in "yyyy-MM-dd" format.
<di:column title="Stock Settlement Date" property="settlementDate" sortable="true" format="{0,date,yyyy-MM-dd}" />
You can also implement your own table decorator or column decorator but I found this option easy and ready to use.
5) Sorting Columns in display tag
Again very easy you just need to specify sortable="true" with <displaytag:column> tag and display tag will make that column sortable. Here is an example of sortable column in display tag.
<di:column title="Stock Price" property="stockPrice" sortable="true" />
6) Making a column link and passing its value as request parameter.
Some time we need to make a particular columns value as link may be to show another set of data related to that value. we can do this easily in display tags by using "href" attribute of <displaytag:column> tag, value of this attribute should be path to target url.If you want to pass value as request parameter you can do that by using another attribute called "paramId", which would become name of request parameter.
Here is example of making link and passing value as request parameter in displaytags.
<di:column property="stockSymbol" sortable="true" href="details.jsp" paramId="symbol"/>
Values on this column will appear as link and when user click on the link it will append a request parameter "symbol" e.g symbol=Sony
7) Default sorting and ordering in displaytag
If you want that your table data is by default sorted based upon a particular column when displayed than you need to defaine a column name for default sorting and an order e.g. ascending or descending. You can achieve this by using attribute "defaultsort" and "defaultorder" of <displaytag:table> tag as shown in below example.
<displaytag:table name="pennyStocks" id="current_penny_stock" export="true" defaultsort="1" defaultorder="descending" uid="1">
This will display table which would be sorted on first column in descending order.
8) Sorting whole list data as compared to only page data in display tag
This was the issue we found once we done with our displaytag jsp. we found that whenever we sort the table by clicking on any sortable column header it only sort the data visible in that page, it was not sorting the whole list provided to display tag I mean data which was on other pages was left out. That was not the desirable action for us. Upon looking around we found that display tag by default sort only current page data but you can override this behavior by providing a displaytag.properties file in classpath and including below line in
displaytag.properties:
sort.amount = list
9) Configuring displaytag by using displaytag.properties
This was important piece of information which we are not aware until we hit by above mentioned issue. Later we found that we can use displaytag.properties to customize different behaviours, appearence of displaytag. Another good behavior we discoved was showing empty table if provided list is null or empty. You can achieve this by adding line "basic.empty.showtable = true". Here was how our properties file look like
//displaytag.properties
sort.amount = list
basic.empty.showtable = true
basic.msg.empty_list=No results matched your criteria.
paging.banner.placement=top
10) Specifying pagesize for paging in a JSP
You can specify how many rows you want to shwo in one page by using "pagesize" attribute of <displaytag:table>. We prefer to use it from configuraiton because this was subject to change.
Overall we found that displaytag was quite rich in functionality, easy to use and highly configurable. Displaytag is also very extensible in terms of customizing export or pagination functionality. Displaytag.org has some very good examples and live demo addressing each of display tag functionality and those are excellent starting point as well. No matter whether you are using struts, spring or plain sevlet based framework for tabular data displaytag is a good choice.
Note: In <displaytag:table> displaytag is tag prefix I used in while declaring tag library using <@taglib> in JSP.
Related Java Tutorials
Labels:
Core Java,
jsp-servlet
Monday 19 August 2013
Top Most Difference between URL-rewriting URL-encoding in Servlet JSP
URL-rewriting vs URL-encoding in Servlet JSP
Main difference between URL-rewriting and URL-encoding is that URL-rewriting is a technique to maintain user session if cookies are not enabled on client browser or browser doesn't support cookie while URL-encoding is a way to pass string to server containing special characters by converting special characters like space into some other characters like + . people often confuse between URL encoding and URL rewriting because of there names which sounds quite similar for new guys but functionality wise they are totally different to each other, Also servlet encodeURL() method adds more confusion because its sounds like its used for URL Encoding but indeed used for URL Rewriting. This is also a very popular servlet and JSP interview questions , I have also shared some more questions on my posts 10 Servlet Interview questions answers and 10 JSP interview questions and answers for Java programmer.
Labels:
jsp-servlet
Sunday 18 August 2013
Top Most 5 Difference between Application Server and Web Server in Java
Application server and web server in Java both are used to host Java web application. Though both application server and web server are generic terms, difference between application server and web server is a famous J2EE interview question. On Java J2EE perspective main difference between web server and application server is support of EJB. In order to run EJB or host enterprise Java application (.ear) file you need an application server like JBoss, WebLogic, WebSphere or Glassfish, while you can still run your servlet and JSP or java web application (.war) file inside any web server like Tomcat or Jetty.
This Java interview question are in continuation of my previous post on interviews like Top 10 Spring interview questions and Top 10 Struts interview question. Here we will see some difference between application server and web server in point format which will help you to answer this question in any java interview.
Labels:
core java interview question,
jsp-servlet
Friday 16 August 2013
Top Most What is load-on-startup servlet element in web.xml with Example?
load-on-startup is an element which appears inside <servlet> tag in web.xml.4 years back load-on-startup was a very popular servlet interview question because not many Java J2EE developer was familiar with this element and how load-on-startup works inside servlet container like tomcat or webshere. In this J2EE Tutorial we will see what is load on start up, how to use load-on-startup element and what are different values we can configure for loadOnStartup inside web.xml.
Labels:
core java interview question,
jsp-servlet
Top Most How to get ServletContext in Servlet, JSP, Action class and Controller.
How to get ServletContext in Servlet, jsp, spring controller or struts action class is common need of any Java web developer. As ServletContext is an application wide object and used to store variables in global scope, getting a reference of ServletContext is pretty important. Every web application can have only one ServletContext though they can have multiple ServletConfig object. In this article we will see :
Read more »
How to get Servlet Context inside Spring MVC Controller?
How to find Servlet Context inside Struts Action class?
How to get Servlet Context inside JSP File?
How to find Servlet Context inside HttpServlet Class?
Labels:
jsp-servlet
Top Most Difference between SendRedirect() and Forward() in JSP Servlet
Difference between SendRedirect and forward is one of classical interview questions asked during java web developer interview. This is not just applicable for servlet but also for JSP in which we can use forward action or call sendRedirect() method from scriptlet. Before examining difference on forward and SendRedirect let’s see what send Redirect method and forward method does.
SendRedirect ():
This method is declared in HttpServletResponse Interface.
Singanature: void sendRedirect(String url)
This method is used to redirect client request to some other location for further processing ,the new location is available on different server or different context.our web container handle this and transfer the request using browser ,and this request is visible in browser as a new request. Some time this is also called as client side redirect.
Forward():
This method is declared in RequestDispatcher Interface.
Signature: forward(ServletRequest request, ServletResponse response)
This method is used to pass the request to another resource for futher processing within the same server, another resource could be any servlet, jsp page any kind of file.This process is taken care by web container when we call forward method request is sent to another resource without the client being informed, which resource will handle the request it has been mention on requestDispatcher object which we can get by two ways either using ServletContext or Request. This is also called server side redirect.
RequestDispatcher rd = request.getRequestDispatcher("pathToResource");
rd.forward(request, response);
rd.forward(request, response);
Or
RequestDispatcher rd = servletContext.getRequestDispatcher("/pathToResource");
rd.forward(request, response);
rd.forward(request, response);
Difference between SendRedirect and Forward
Now let’s see some difference between these two method of servlet API in tabular format.
Forward() | SendRediret() |
When we use forward method request is transfer to other resource within the same server for further processing. | In case of sendRedirect request is transfer to another resource to different domain or different server for futher processing. |
In case of forward Web container handle all process internally and client or browser is not involved. | When you use SendRedirect container transfers the request to client or browser so url given inside the sendRedirect method is visible as a new request to the client. |
When forward is called on requestdispather object we pass request and response object so our old request object is present on new resource which is going to process our request | In case of SendRedirect call old request and response object is lost because it’s treated as new request by the browser. |
Visually we are not able to see the forwarded address, its is transparent | In address bar we are able to see the new redirected address it’s not transparent. |
Using forward () method is faster then send redirect. | SendRedirect is slower because one extra round trip is required beasue completely new request is created and old request object is lost.Two browser request requird. |
When we redirect using forward and we want to use same data in new resource we can use request.setAttribute () as we have request object available. | But in sendRedirect if we want to use we have to store the data in session or pass along with the URL. |
Example of forward and SendRedirect in JSP Servlet:
Any kind of online payment when we use merchant site will redirect us to net banking site which is completely new request it process our request and again redirect to merchant site?
In Banking Application when we do login normally we use forward method. In case of online banking we are asked for username and password if it’s a correct some another servlet or resource will handle the request other wise request has been forwarded to error page.
Which one is good?
Its depends upon the scenario that which method is more useful.
If you want control is transfer to new server or context and it is treated as completely new task then we go for Send Redirect.
Normally forward should be used if the operation can be safely repeated upon a browser reload of the web page will not affect the result.
SendRedirect and forward method are still very useful while programming or working on any web application project using servlet jsp. This is still a popular interview questions so don’t forget to revise forward and sendRedirect before appearing for any job interview.
Some more interview post you may find Interesing
Labels:
Core Java,
core java interview question,
jsp-servlet
Thursday 15 August 2013
Top Most LDAP Active Directory Authentication in Java Spring Security Example Tutorial
LDAP authentication is one of the most popular authentication mechanism around the world for enterprise application and Active directory (an LDAP implementation by Microsoft for Windows) is another widely used ldap server. In many project we need to authenticate against active directory using ldap by credentials provided in login screen. Some time this simple task gets tricky because of various issues faced during implementation and integration and no standard way of doing ldap authentication. Java provides ldap support but in this article I will mostly talk about spring security because its my preferred Java framework for authentication, authorization and security related stuff. you can do same thing in Java by writing your own program for doing LDAP search and than LDAP bind but as I said its much easier and cleaner when you use spring security for LDAP authentication.
Labels:
Core Java,
jsp-servlet,
spring
Tuesday 13 August 2013
Top Most Java PropertyUtils Example - getting and setting properties by name
PropertyUtils class of Apache commons beanutils library is very useful and provides you ability to modify properties of Java object at runtime. PropertyUtils enables you to write highly configurable code where you can provide name of bean properties and there values from configuration rather than coded in Java program and Apache PropertyUtils can set those properties on Java object at runtime. One popular example of how powerful PropertyUtils can be is display tag which provides rich tabular display for JSP pages, it uses PropertyUtils class to get values of object at runtime and than display it. You can setup properties as column and only selected columns will be displayed. Even larger web framework like Struts and Spring also uses Apache commons beanutils library for getting and setting java properties by name.
PropertyUtils is based on Java reflection but provides convenient method to operate on Java object at runtime. By using PropertyUtils you can get map of all Object properties which enables you to change them at runtime by values coming from all the places like web request, database or configuration files. In this Java tutorial we will example of how to get and set properties of java object using PropertyUtils class at runtime.
This article is in continuation of my earlier post on open source library like How to limit number of user session in web application using Spring Security and How to perform LDAP authentication on windows Active directory using Spring Security. If you haven’t read them already you may find them useful and interesting.
Labels:
Core Java,
jsp-servlet
Top Most Difference between Struts 1 and Struts 2 framework
I had work previously on Struts 1 but never touched Struts 2, specially since Spring MVC was there to take the leading role. Recently one of my friend ask me to help with Struts2, which leads me to look on Struts2 framework from start. First thing I wanted to find out differences between Struts 1 and Struts 2 framework, because in my experience, if you have worked in previous version looking differences between two versions of Struts can quickly help to find, what changes and What are the new features, concepts and improvement is offered by Struts 2. Also difference between Struts 1 and Struts 2 is a good candidate to include in my list of Struts interview questionfor quick revision. To my surprise, Struts 2 seems to be completely different than Struts 1 framework, because some of the most familiar stuff like ActionForm, struts-config.xml, and Action classes are changed in Struts 2 framework. Struts 2 has also done good job on removing direct dependency of Action classes on Servlet API e.g. HttpServletRequest and HttpServletResponse, which makes testing easy by using Dependency Injection concept. In this article, we will some important differences between Struts 1 and Struts 2 framework.
Labels:
core java interview question,
J2EE,
jsp-servlet,
struts
Monday 12 August 2013
Top Most What is JSESSIONID in J2EE Web application - JSP Servlet?
What is JSESSIONID in JSP Servlet
JSESSIONID is a cookie generated by Servlet container like Tomcat or Jetty and used for session management in J2EE web application for http protocol. Since HTTP is a stateless protocol there is no way for Web Server to relate two separate requests coming from same client and Session management is the process to track user session using different session management techniques like Cookies and URL Rewriting. If Web server is using cookie for session management it creates and sends JSESSIONID cookie to the client and than client sends it back to server in subsequent http requests. JSESSIONID and session management is a not only a popular Servlet interview question but also appear in various JSP interviews. Along with What is JSESSIONID interviewer are also interested in when and how JSESSIONID is created in Servlet and JSP which we will see in next section.
Labels:
interview questions,
jsp-servlet
Top Most 5 JSTL Core IF Tag Examples in JSP - Tutorial
<c:if> or if tag of JSTL core tag library in JSP is one of the most versatile and useful tag. JSTL if tag allows you
to test for a condition, like checking for a particular parameter in requestScope, sessionScope or pageScope. You can also check any parameter in request parameters and headers or can check for a variable in JSP page using <c:if> tag. JSTL if tag helps a lot to reduce amount of Java code from JSP page and if used, along with expression language JSTL core tag library, can remove almost all Java code from JSP files. Earlier we have seen examples of JSTL foreach tag and JSTL core set tag and this JSP JSTL tutorial is based on if tag of JSTL core tag library. We will, see how to use <core:if> tag inside JSP files and different example of <core:if> tag to get ourselves familiar with functionality and power offered by JSTL <c:if> tag. After seeing these examples of <core:if> tag along with expression language, You will be amazed to see, how clean your JSP looks like.
Labels:
coding,
J2EE,
jsp-servlet,
JSTL
Subscribe to:
Posts (Atom)
Labels
Core Java
programming
core java interview question
Core Java Faq's
Servlets
coding
database
jsp-servlet
spring
Java
linux
unix
interview questions
java investment bank
Web Services
Interview
investment bank
mysql
Senior java developer interviews
best practices
java collection tutorial
RMI
SQL
Eclipse
FIX protocol tutorial
tibco
J2EE
groovy
java questions
SCJP
grails
java 5 tutorial
jdbc
beginner
error and exception
Design Patterns
Java Programming Tutorials
fundamentals
general
object oriented programming
xml
Java Programs
Hibernate
Examples
Flex
JAMon
Java xml tutorial
logging
Jsp
Struts 2.0
Sybase and SQL Server
debugging
java interviews
performance
FIX Protocol interview questions
JUnit testing
WebSphere
date and time tutorial
experienced
java IO tutorial
java concurrency
thread
Ejb
Freshers Papers
IT Management
Java Exapmle
Java Script
SQL and database tutorial examples
Scwcd
ant tutorials
concurrency example and tutorial
future state
homework
java changes
java threading
tricky
Agile
Business of IT
Development
JSTL
Java JSON tutorial
Java multithreading Tutorials
PM
Scrum
data structure and algorithm
java puzzles
java tips
testing
tips
windows 8
5 way to create Singleton Object
Architect Interview Questions and Answers
Architecture
Architecure
Bluetooth server as swing application that searches bluetooth device in 10 meter circle and show all devices. You can send file to any bluetooth device.
C Programming
CIO
Callable Statement in Java
Circular dependency of Objects in Java
Comparable Example in Collection
Custom annotation in Java
Developer Interview
Divide and rule example in java
Drupal
Example of Singleton Pattern
FIX protocol
ForkJoin Example in Java 7
Get data from dynamic table with Java Script
Git
HTML and JavaScript
Health
Hello World TCP Client Server Networking Program
Hibernate Basics
Hibernate Interview Question Answer
J2EE Interview Question And Answers
J2ME GUI Program
JEE Interview QA
JMS interview question
Java J2EE Hibernate Spring Struts Interview Question
Java System Property
Java Threads
Manager
Portlets
Provident Fund
Read data from any file in same location and give the required result.
Reading Properties File in Java
Redpoint
Rest WebService Client
Rest Webservice Test
SAL join with ven diagram
SCP UNIX COMMAND
SSL
Singleton Pattern in Java
Spring Bean Initialization methods and their order
Spring Interview Questions
Struts
Struts 2.0 Basics
Struts 2.0 Design Pattern
Submit Html Form With Java Script On The Fly
Unix executable For Java Program
XOM DOM SAX
XP
books
computers
core java;
core java; object oriented programming
data structure; java investment bank;
design pattern
dtd
duplicate rows in table
get browser name with jquery
grails podcast
inner class
java beginners tutorial
java cache
java networking tutorial
java spring
java util; java collections; java questions
java.java1.5
linked list
mailto function with all browser
oracle database
oracle duplicate rows
orm
schema
social
spring mvc questions
struts
transaction
tricks
tweet
windows
xslt