{"id":2422,"date":"2013-09-30T13:58:25","date_gmt":"2013-09-30T11:58:25","guid":{"rendered":"http:\/\/www.tutego.de\/blog\/javainsel\/?p=2422"},"modified":"2013-09-30T13:58:25","modified_gmt":"2013-09-30T11:58:25","slug":"klausuraufgabe-javaserver-pages-und-verwandte-technologien","status":"publish","type":"post","link":"https:\/\/www.tutego.de\/blog\/javainsel\/2013\/09\/klausuraufgabe-javaserver-pages-und-verwandte-technologien\/","title":{"rendered":"Klausuraufgabe: JavaServer Pages und verwandte Technologien"},"content":{"rendered":"<p>Am 8. Feb. 2002 unterrichtete ich noch am Bildungszentrum f\u00fcr informationsverarbeitende Berufe e. V. (BIB) Informatik und insbesondere Java und stellte unter anderem diese Klausur. Wie w\u00fcrdet ihr abschneiden?<\/p>\n<h3>Aufgabe 1<\/h3>\n<p>Ja\/Nein-Fragen. Kreuze die jeweils richtige Aussage an.<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p><b>Frage<\/b><\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">\n<p><b>Ja<\/b><\/p>\n<\/td>\n<td valign=\"top\" width=\"59\">\n<p><b>Nein<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Ein Assoziativspeicher kann mit einem Schl\u00fcssel mehr als nur einen Wert verbinden.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Auf der Server-Seite haben wir es niemals mit Socket-Objekten zu tun.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Sei o eine Referenz-Variable f\u00fcr ein beliebiges aber gesetztes Objekt. Dann ist der Ausdruck o instanceof Object immer wahr.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Der Konstruktor von java.io.RandomAccessFile kann eine IOException werfen, die abgefangen werden muss.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Die Klasse java.io.File bietet eine Funktion readLine()<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>OutputStream und InputStream sind abstrakte Klassen<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Das Skriptlet &lt;%= out.println(2); %&gt; wird vom JSP-Compiler zur\u00fcckgewiesen.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Mit dem Objekt request kommt man an die Daten, die der Server an den Browser stellt.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Implizite Objekte m\u00fcssen vom Benutzer erst erzeugt werden.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Bei Optionsfeldern kann es passieren, dass Parameter gleich benannt sind.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Ein Formular mit der GET-Methode erzeugt eine URL mit etwa folgendem Aufbau: <a href=\"http:\/\/host\/test.jsp&amp;x=12?y=100\">http:\/\/horst\/test.jsp&amp;x=12?y=100<\/a><\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Eine Java Bean ist eine Klasse, die eine spezielle Schnittstelle implementieren muss.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Eine Java Bean ist eine Klasse, die von keine spezielle Klasse erben muss.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Sei a ein Attribut vom Typ int. Dann hat die Setze-Funktion die Signatur void setA( int i ).<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>JSP bietet eine M\u00f6glichkeit, dass Formular-Eintr\u00e4ge automatisch in eine Bean eingetragen werden.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Mit einem Cookie kann man Informationen auf der Server-Seite hinterlegen.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Zum Einbinden von java.util und java.sql schreibt man die Direktive<\/p>\n<p>&lt;%! Include&quot;java.util&quot;, &quot;java.sql&quot; %&gt;<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Ein Webkontext in der <i>server.xml<\/i> Konfigurationsdatei von Tomcat assoziiert einen beliebigen Server mit einem physikalischen Verzeichnis.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Erfragt man mit request.getParameter() einen nicht existierenden Parameter, wird eine NullPointerException ausgel\u00f6st.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"691\">\n<p>Kleine Informationseinheiten k\u00f6nnen auf der Client-Seite des Benutzers abgelegt werden.<\/p>\n<\/td>\n<td valign=\"top\" width=\"47\">&nbsp;<\/td>\n<td valign=\"top\" width=\"59\">&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Aufgabe 2<\/h3>\n<p>Schreibe JSP-Code, welches eine Funktion bold() deklariert. Die Methode soll eine Zeichenkette s entgegennehmen und eine Zeichenkette zur\u00fcckliefen, die den \u00fcbergebenen String mit &lt;b&gt; und &lt;\/b&gt; umrahmt. Beispiel: Aus Peter Pan wird &lt;b&gt;Peter Pan&lt;\/b&gt;.<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>Nutze die Funktion ist einem JSP-Ausdruck.<\/p>\n<p>&lt;%=&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; %&gt;<\/p>\n<h3>Aufgabe 3<\/h3>\n<p>Gegeben ist ein Formular mit einem Textfeld. Nach dem Abschicken wird eine URL mit dem Namen <u>http:\/\/server.org\/db\/klein\/send.jsp?name=paulchen<\/u> formuliert. Wie sieht ein Skriptlet aus, welches den existierenden Namen ausliest?<\/p>\n<p>&lt;%<\/p>\n<p>String name;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>%&gt;<\/p>\n<p>Nun soll die L\u00e4nge des Namens (die L\u00e4nge eines Strings kann man mit der Funktion length() erfragen) ausgegeben werden. Was muss man schreiben, wenn es Fehler bei der URL gibt? Beachte nicht existierende Parameter und leere Parameter. Gibt es Fehler, soll die L\u00e4nge \u20131 ausgegeben werden.<\/p>\n<p>&lt;%<\/p>\n<p>String name; int len = -1;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>%&gt;<\/p>\n<p>&lt;%=&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; %&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Am 8. Feb. 2002 unterrichtete ich noch am Bildungszentrum f\u00fcr informationsverarbeitende Berufe e. V. (BIB) Informatik und insbesondere Java und stellte unter anderem diese Klausur. Wie w\u00fcrdet ihr abschneiden? Aufgabe 1 Ja\/Nein-Fragen. Kreuze die jeweils richtige Aussage an. Frage Ja Nein Ein Assoziativspeicher kann mit einem Schl\u00fcssel mehr als nur einen Wert verbinden. &nbsp; &nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[1],"tags":[],"class_list":["post-2422","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/2422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/comments?post=2422"}],"version-history":[{"count":1,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/2422\/revisions"}],"predecessor-version":[{"id":2423,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/2422\/revisions\/2423"}],"wp:attachment":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/media?parent=2422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/categories?post=2422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/tags?post=2422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}