2012/2013 2nd Semester
Name / Nom :
JEE Examination
Documents autorisés / Authorized documents : Aucun / None Durée / Duration : 1h35.
Question 1 : Pourquoi est-il plus compliqué d'utiliser un objet de type Datasource de JDBC 2 dans un environnement Java Standard que dans un environnement de type Web Dynamique ?
Why is it more diffucult to operate with a JDBC 2 Datasource object in a standalone Java Environment than in a Java Web Dynamic Application environment?
(2 points / 5 minutes)
Question 2 : Pour quelle raison pourrait-on préciser l'attrinbut “type” dans le mapping Hibernate d'une propriété d'une classe ? Que se passe t-il si on ne précise pas cet attribut ?
What could be the reason to indicate the “type” attribute in the Hibernate mapping of a class property? What will happen if this attribute is not defined by the programmer?
(1 points / 5 minutes)
Question 3 : Pour quelle raison est-il déconseillé de systématiquement désactiver le lazy- loading hibernate ?
For what reason is it not recommended to systematically deactivate the default lazy loading mode of Hibernate?
(3 points / 5 minutes)
Question 4 : Peut-on se passer de la méthode Hibernate.initialize() et si oui, quelle(s) peut (peuvent) être la (les) solution(s) de remplacement ?
Could we avoid the Hibernate.initialize() method? If Yes, what could be the solution(s) to get the same results?
(2 points / 5 minutes)
Question 5 : Quand est-il nécessaire d'utiliser la méthode merge de la Session Hibernate pour mettre à jour un enregistrement ?
When is it necessary to use the merge method of the Hibernate Session to update a database record?
(2 points / 5 minutes)
Question 6 : Comment fonctionne la technologie JSP du point de vue du serveur applicatif
?
How does the JSP technology work on the application server side?
(2 points / 5 minutes)
Question 7 : Pour quelle raison les composants Java pris en charge par Spring héritent-ils généralement d'une interface Java.
Why do the Java components managed by Spring mainly inherit from Java Interfaces?
(2 points / 5 minutes)
Question 8 : Citez 2 technologies qui exploitent la norme JavaBean et expliquez de quelle
manière.
Quote 2 technologies dealing with theJavaBean norm, explain how.
(2 points / 5 minutes)
Question 9 : Par quelle méthode de HttpServlet sont traitées les requêtes HTTP
POST suite à un forward (RequestDispatcher) d'une autre Servlet ? Qu'en est-il suite à un redirect (HttpServletResponse)? Pourquoi ?
What will be the HttpServlet method in charge of processing HTTP POST request in case it comes after a forward (RequestDispatcher) triggered by another Servlet? What will be the method is case of a redirect (HttpServletResponse)? Why?
(2 points / 5 minutes)
Question 10 : Peut-on reproduire la configuration suivante en utilisant des annotations ? Expliquez.
Could we obtain the same configuration by annotation? Explain.
<?xml version="1.0" encoding="UTF-8"?>
<beans ... ...">
<bean class="com.jnesis.MyService" scope="prototype">
<property name="aCollaborator" ref="collaborator"/>
</bean>
<bean id="mySecondService" class="com.jnesis.MyService">
</bean>
<bean id="collaborator" class="com.jnesis.MyCollaborator">
</bean>
</beans>
(1 points / 5 minutes)
Question 11 : Expliquez l'autowiring dit 'byType' ? Explain how does the autowiring 'byType' work?
(2 points / 5 minutes)
Question 12 : Pourquoi dit-on que Spring est un framework qui est en charge de la configuration de l'architecture applicative ?
Why do we say that Spring is a framework in charge of the configuration of an application architecture ?
(3 points / 5 minutes)
Question 13 : Comment le conteneur de Servlet traitera-t-il l'URL
http://host:8080/contextRoot/POST/presentations/first.ppt dans la configuration du web.xml ci-dessous :
How will the Servlet Container process the URL
http://host:8080/contextRoot/POST/presentations/first.ppt within the web.xml configuration below:
...
<servlet>
<servlet-name>PPTServlet</servlet-name>
<servlet-class>final.PPTServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PPTServlet</servlet-name>
<url-pattern>*.ppt</url-pattern>
</servlet-mapping>
<filter>
<filter-name>PPTRootPostFilter</filter-name>
<filter-class>final.PPTRootPostFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PPTRootPostFilter</filter-name>
<url-pattern>/POST/*</url-pattern>
</filter-mapping>
...
(2 points / 5 minutes)
Question 14 : Que pensez-vous de la page JSP suivante ? Que fait-elle exactement et est-elle selon vous bien écrite ?
How do you consider the following JSP Page? What will be the result and is the code correct?
__________________________________________________________________
...<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%!String name=request.getParameter("name");
out.println("Hello "+name);
%>
</body>
</html>}
___________________________________________________________________
(3 points / 5 minutes)
Question 15 : Ecrivez la page JSP équivalente à cette Servlet en utilisant uniquement les expressions JSP EL.
Write a JSP page equivalent to the following Servlet code using only JSP EL.
__________________________________________________________________
...
package p2013;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import exam.Student;
public class TestServlet extends HttpServlet { public TestServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String login=request.getParameter("login");
HttpSession session=request.getSession();
Student s=(Student)session.getAttribute("student");
PrintWriter out=response.getWriter();
out.println("<HTML><BODY>Your login is "+login);
out.println("The student's name is "+s.getName()+"</BODY></HTML>);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
} }
___________________________________________________________________
(5 points / 15 minutes)
Question 16 : Barrez les affirmations fausses.
Stroke the wrong assertions.
• Un moteur de Servlet met en oeuvre le principe d'inversion de contrôle pour piloter le cycle de vie des Servlet
• L'annotation @Component indique que les instances issues de cette classe sont des composants réutilisables
• L'annotation @Resource permet de valoriser les collaborateurs d'un composant auto-détécté par Spring pour peu que la classe bénéficie d'une annotation adéquate et présent dans un package ciblé par un <context:component-scan>
• Hibernate impose la présence d'une information identifiante dans les tables appairées aux entités Java dont il a la charge.
• Spring et Hibernate sont des frameworks Java EE
• @Resource est une annotation Spring permettant l'injection de dépendance
(6 points / 10 minutes)