Tuesday, November 30, 2010

Interview with JDA Hyderabad

1. Same class name in two different war files
2. Create own datastrucutre
3. Jsp usebeans
4. Servlet context implemetation
5. Log4j impl
6. Bottom 3 salaries
7. Spring why?
8. Sax vs Dom



======================================================
Q1. Same class name in two different war files
http://www.redbooks.ibm.com/redpapers/pdfs/redp4307.pdf

Q3. Jsp usebeans vs import


This checks if an object called "myBean" exists in the session
attributes, and if necessary creates and puts it there. It also adds a
variable called "myBean" that can be referenced later, in e.g.
<%=myBean.getFoo()%>.

When you develop a bean to be used in a JSP page, I recommend that you make it part of a named package. A Java class that does not use a package statement ends up in the so-called unnamed package. The servlet class generated from the JSP page is, however, typically assigned to a named package. If you try to refer to a class in the unnamed package from a class in a named package, Java cannot find the class unless you use an import statement to import it. In a JSP page that means you must use both a page directive to import the class, and the action to make it available:

<%@ page import="UserInfoBean" %>


If the bean is part of a named packed, the action is all you need:

class="com.mycompany.UserInfoBean" />

No comments:

Post a Comment