Changeset 11:267cce6b9d77

Show
Ignore:
Timestamp:
05/28/09 23:12:19 (9 years ago)
Author:
František Kučera <franta-hg@…>
Branch:
default
Message:

Servlet pro zpracování AJAXových požadavků.

Location:
java/sql-vyuka
Files:
2 added
3 modified

Legend:

Unmodified
Added
Removed
  • java/sql-vyuka/web/WEB-INF/casti/aplikace.jspx

    r10 r11  
    2222                <h2><fmt:message key="blok.zadavani"/></h2> 
    2323                <div class="vnitrekBloku"> 
    24                     <form action="#"> 
     24                    <form action="#" name="aplikace"> 
    2525                        <fieldset> 
    26                             <textarea id="vstupniPole" rows="100" cols="1000"><fmt:message key="vychozi.sql"/></textarea> 
     26                            <textarea id="vstupniPole" name="vstupniPole" rows="100" cols="1000"><fmt:message key="vychozi.sql"/></textarea> 
    2727                            <button class="zobrazitHistorii" 
    2828                                    name="zobrazitHistorii" 
  • java/sql-vyuka/web/WEB-INF/web.xml

    r8 r11  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
     3    <servlet> 
     4        <servlet-name>Servlet</servlet-name> 
     5        <servlet-class>cz.frantovo.sql.vyuka.ajax.Servlet</servlet-class> 
     6    </servlet> 
     7    <servlet-mapping> 
     8        <servlet-name>Servlet</servlet-name> 
     9        <url-pattern>/ajax</url-pattern> 
     10    </servlet-mapping> 
    311    <session-config> 
    412        <session-timeout> 
     
    816    <welcome-file-list> 
    917        <welcome-file>index.jsp</welcome-file> 
    10         </welcome-file-list> 
    11     </web-app> 
     18    </welcome-file-list> 
     19</web-app> 
  • java/sql-vyuka/web/hlavni.js

    r10 r11  
    2828 **/ 
    2929function getSQL() { 
    30     return document.getElementById(vstupniPole).innerHTML; 
     30    return document.aplikace.vstupniPole.value; 
    3131} 
    3232 
     
    6868function ajaxVykonatSQL() { 
    6969    if (ajax.readyState == 4 || ajax.readyState == 0) { 
    70         ajax.open("GET", 'vysledek.html', true); 
     70        ajax.open("POST", 'ajax?akce=vykonat&sql=' + encodeURIComponent(getSQL()), true); 
    7171        ajax.onreadystatechange = vykonatSQLVypis; 
    7272        ajax.send(null); 
     
    8787function ajaxZobrazitHistorii() { 
    8888    if (ajax.readyState == 4 || ajax.readyState == 0) { 
    89         ajax.open("GET", 'historie.html', true); 
     89        ajax.open("POST", 'historie.html', true); 
    9090        ajax.onreadystatechange = zobrazitHistoriiVypis; 
    9191        ajax.send(null);