2012/2013 1st Semester
Name / Nom :
JEE Examination
Documents autorisés / Authorized documents : Aucun / None Durée / Duration : 2h.
Question 1 : Parmi les technologies ci-dessous, lesquelles sont issues de standards JEE ?
Among technologies listed below, which do come from JEE standards?
□ Servlet □ Spring
□ JSP □ Spring MVC
□ Hibernate □ EJB
□ JDBC □ JSF
(2 points / 3 minutes)
Question 2 : Quelle(s) étape(s) est (sont)-elle(s) nécessaire(s) pour exploiter dans une page JSP une expression EL de la norme JSP.
List the step(s) to be completed before using in a JSP file the JSP EL expressions.
(2 points / 2 minutes)
Question 3 : Expliquez la problématique de “Thread Safety” à laquelle le développeur doit prendre garde lors du développement de Servlet ou de JSP.
Describe the “Thread Safety” issue related to the Servlet and JSP development.
(2 points / 5 minutes)
Question 4 : Quelle différence existe t-il entre un fichier .jar et un fichier .war?
What's the difference between .jar and .war files?
(1 point / 2 minutes)
Question 5 : Complétez le shéma d'architure d'application Web en positionnant les couches applicatives de presentation, controleur, service, DAO et persistance : Complete the web application architecture below by positioning applicative layers of presentation, controller, service, DAO and persistence :
(2,5 points / 2 minutes)
Question 6 : Que signifie la ligne suivante ? What does the following piece of code mean?
...
<%@taglib uri="http://brainstroming.com/taglib" prefix="brain"%>
...
(1 point / 2 minutes)
Question 7 : Commentez le code suivant. Comporte t-il des erreurs et vous paraît-il correct en tous points de vue ?
Comment the following piece of code. Do you find some mistakes in it and does this piece of code match with development best practices?
...
<%
HttpSession session=request.getSession();
int invoiceId=request.getParameter("invoiceid");
Invoice i=InvoiceService.getInvoice(invoiceId);
session.setAttribute("invoiceToDisplay",i);
%>
${invoiceToDisplay.getNumber()}
...
(5 points / 10 minutes)
Question 8 : Quelle est l'utilité d'écrire une classe selon la norme JavaBean ? For what reason would you write a class responding to the JavaBean norm?
(2 points / 5 minutes)
Question 9 : Qu'apporte l'introduction d'un annuaire JNDI dans les architectures 3 tiers ? What are the benefits of the usage of a JNDI server in the 3 tiers architectures?
(2 points / 5 minutes)
Question 10 : Commentez le code suivant. Vous paraît-il conforme au standard DAO ? Comment the following code. Is it fitting with the DAO standard?
...
@Component
public class InvoiceDAO {
@Resource
public File sourceOfData;
public MyFileHelper helper=new MyFileHelper();
public void deleteAllInvoices(){
helper.deleteAllRecordsFrom(sourceOfData);
} }
(3 points / 5 minutes)
Question 11 : Que signifie l'extrait de code suivant ? What does the following code snippet mean?
...
<c:foreach var="p" items="${step.param}">${p.val2.val3}</c:foreach>
...
(3 points / 5 minutes)
Question 12 : Comment fait-on pour déclencher un ordre SQL en UPDATE par le biais des mécanismes standards de Hibernate ?
How should we proceed to trigger a SQL UPDATE query by the way of the standard Hibernate mechanisms?
(3 points / 3 minutes)
Question 13 : Quelle(s) différence(s) allez-vous trouver dans 2 DAOs ayant les mêmes fonctions mais l'un exploitant la technologie JDBC, l'autre la technologie Hibernate.
What will be the differences between 2 DAOs having the same function, the first using the JDBC API, the second operating with Hibernate?
(1 point / 2 minutes)
Question 14 : A quoi sert la méthode statique Hibernate.initialize() ? What aims the Hibernate.initialize() method?
(3 points / 5 minutes)
Question 15 : Quelle démarche allez-vous utiliser pour écrire un(les) fichier(s) de mapping Hibernate qui concerne 2 entités liées par une relation one to many dans les cas suivants?
How would you proceed to write (a) hibernate mapping file(s) related to 2 entities involved in a one to many relationship in the following cases?
• Le code Java et le modèle de données n'existent pas encore. Neither the Java code nor the database model exist
• Vous disposez uniquement du code Java, le modèle de données n'existe pas encore. You only have the Java code, the database model is to be determined
• Vous disposez uniquement modèle de données, le code Java n'existe pas encore.
You only have the database model, the Java code is to be determined
(3 points / 8 minutes)
Question 16 : Suite à un appel à la méthode save(Object obj) ou persist(Object obj) d'une session Hibernate puis d'un commit() de la transaction, comment récupère t-on l'identifiant de l'objet créé si cet identifiant est généré automatiquement par la base de donnnées ?
After having called the Hibernate session's save(Object obj) or persist(Object obj) method followed by a commit() of the transaction, how should we proceed to get back the saved object's identifier in case this identifier is auto-generated by the database itself?
(2 points / 2 minutes)
Question 17 : Que permet le mode 'cascade' de Hibernate.
What is the Hibernate 'cascade' mode for?
(1,5 points / 3 minutes)
Question 18 : Quel est l'objectif du framework Spring. A votre connaissance, existe t-il une autre solution technologique qui tente de répondre au même besoin ?
What does Spring focus on? From your experience, is there another technological solution focusing on the same need?
(2 points / 5 minutes)
Question 19 : Expliquez le principe d'autowiring dit 'byType' ? Explain the principle of autowiring 'byType'?
(2 points / 5 minutes)
Question 20 : Expliquez l'extrait de fichier de configuration Spring applicationContext.xml suivant :
Explain the following Spring configuration file applicationContext.xml snippet :
<?xml version="1.0" encoding="UTF-8"?>
<beans ... ...">
<util:list id="environments">
<bean local="myService"/>
</util:list>
<context:component-scan base-package="com.tools"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:com/jnesis/props.properties"/>
</bean>
<bean class="com.jnesis.MyDAO"/>
<bean id="myService" class="com.jnesis.MyService" autowire="byName">
<property name="dateApplication" value="10/12/2007"/>
</bean>
<bean id="conversionService"
class="org.springframework.format.support.FormattingConversionServiceFactoryBean"/>
<import resource="applicationContext-add-${deployment.company}.xml" />
</beans>
(6 points / 15 minutes)
Question 21 : D'après les extraits qui suivent, comment Spring va-t-il traiter les classes EmployeeService et MedicalCare ? Finalement, quels seront les beans gérés par le conteneur (précisez leur identifiant et la valeur de leurs propriétés) ?
Regarding the following code snippets, how will Spring process the EmployeeService and MedicalCare classes? Finally, which will be the beans managed by the container (indicate their identifier and properties values)?
__________________________________________________________________
...@Service
public class EmployeeService{
@Resource
private MedicalCareInterface medicare;
} __________________________________________________________________
...@Component("medidata")
public class MedicalCare implements MedicalCareInterface{
public MedicalCare(){
super();
}
public void register(){
System.out.println("Registration done");
} }
___________________________________________________________________
(3 points / 10 minutes)
Question 22 : Quelle différences existent-il entre Spring et Spring MVC?
What's the difference between Spring and Spring MVC?
(2 points / 3 minutes)
Question 23 : Qu'est ce qu'un controleur au sens Spring MVC ? What's a controller from the Spring MVC point of view?
(2 points / 5 minutes)
Question 24 : Décriver la méthode de controleur suivante ? Describe the following controller method?
...
@RequestMapping("/myprofile/password")
public void editPassword(@ModelAttribute("passwordEmbedded") EditMyProfilePasswordStruct struct,@RequestParam("newPassword") String newPassword,@RequestParam("oldPassword") String oldPassword) {
struct.setNewPassword(newPassword);
struct.setOldPassword(oldPassword);
validatePasswords(struct);
}...
(4 points / 8 minutes)