<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page import = "java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="de.tum.sep.*" %>
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Anbieter</title>
</head>
<%
String anzahlPersonenStr = (String)request.getParameter("nPerson");
String anzahlPersonenMinusStr = (String)request.getParameter("nPersonMinus");
String addPersonenStr = (String)request.getParameter("addPersonal");
String deleltePersonenStr = (String)request.getParameter("nPersonMinus");
String nameAnbieter = (String)request.getParameter("nameAnbieter" );
String adresse = (String)request.getParameter("adresse");
String plz = (String)request.getParameter("plz");
String ort = (String)request.getParameter("ort");
String land = (String)request.getParameter("land");
String url = (String)request.getParameter("url");
String emailAnbieter = (String)request.getParameter("emailAnbieter");
int anzahlPersonenMinus = 0;
int anzahlSaveData;
int anzahlClose;
String showNachnameStr = (String)request.getParameter("showNachname");
String showVornameStr = (String)request.getParameter("showVorname");
String showAbteilungStr = (String)request.getParameter("showAbteilung");
String showEmailStr = (String)request.getParameter("showEmail");
String showTelPerStr = (String)request.getParameter("showTelPer");
String anzahlSaveDataStr = (String)request.getParameter("nSaveData");
String anzahlCloseStr = (String)request.getParameter("anzahlClose");
%>
<body bgcolor="#DDDDDD">
<form method="post" action="anbieter.jsp">
<%
if (request.getParameter("weiter") != null)
{
if ( anzahlSaveDataStr == null)
{ anzahlSaveData = 0 ;
// out.println("name= " + name.length());
%>
<h2><font color="#FF0000">Bitte bestimmen Sie die Daten.</font></h2>
<table width="700" border="0">
<tr>
<td width="126"> Name: </td>
<td width="148">
<input type="text"
name="nameAnbieter" value="<%= nameAnbieter %>" /></td>
<td width="412">
<%
if ( nameAnbieter.length() >30 ){
%>
<font
color="#FF0000"> Bitte geben Sie die Zeichen nicht langer als 30
Stellig</font>
<%
}if ( nameAnbieter.length() == 0){
%>
<font color="#FF0000"> Bitte geben Sie die Zeichen ein</font>
<%
}
%>
</td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Adresse: </td>
<td
width="148"><input type="text" name="adresse" value="<%=
adresse %>" /></td>
<td width="412">
<%
if ( adresse.length() >50 ){
//out.println("adresse =" + adresse.length());
%>
<font
color="#FF0000"> Bitte geben Sie die Zeichen nicht langer als 50
Stellig</font>
<%
}if ( adresse.length() == 0){
%>
<font color="#FF0000"> Bitte geben Sie die Zeichen ein</font>
<%
}
%>
</td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">PLZ:</td>
<td
width="148"><input type="text" name="plz" value="<%= plz
%>" /></td>
<td width="412">
<%
if ( plz.length() >10 ){
%>
<font
color="#FF0000"> Bitte geben Sie die Zahl nicht langer als 6
Stellig</font>
<%
}if ( plz.length() == 0){
%>
<font color="#FF0000"> Bitte geben Sie die Zeichen ein</font>
<%
}
%>
</td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Ort:</td>
<td
width="148"><input type="text" name="ort" value="<%= ort
%>"/></td>
<td width="412">
<%
if ( ort.length() >20 ){
%>
<font
color="#FF0000"> Bitte geben Sie die Zeichen nicht langer als 20
Stellig</font>
<%
}if ( ort.length() == 0){
%>
<font color="#FF0000"> Bitte geben Sie die Zeichen ein</font>
<%
}
%>
</td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Land:</td>
<td
width="148"><input type="text" name="land" value="<%= land
%>" /></td>
<td width="412">
<%
if ( land.length() >20 ){
%>
<font
color="#FF0000"> Bitte geben Sie die Zeichen nicht langer als 20
Stellig</font>
<%
}
if ( land.length() == 0){
%>
<font color="#FF0000"> Bitte geben Sie die Zeichen ein</font>
<%
}
%>
</td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Website/URL:</td>
<td
width="148"><input type="text" name="url" size="25" value="<%=
url %>" maxlength="100" /></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">eMail:</td>
<td
width="348"><input type="text" name="emailAnbieter" size="25"
value="<%= emailAnbieter %>" maxlength="100" />
</td>
<td width="212"></td>
</tr>
</table>
<table width="600" border="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<!--Personal
Bereich################################################################################-->
<%
int anzahlPersonen ;
if ((anzahlPersonenStr == null) || anzahlPersonenStr.equals("0"))
{anzahlPersonen = 0;
//out.println("anzahlPersonenNull=" + anzahlPersonen);
}
else {
anzahlPersonen
= Integer.parseInt(anzahlPersonenStr,
10);
//
out.println("anzahlPersonenSubmit= " + anzahlPersonen);
for (int i = 1; i <= anzahlPersonen; ++i)
{
String nachname = (String)request.getParameter("nachname" + i);
String vorname = (String)request.getParameter("vorname" +i);
String abteilung = (String)request.getParameter("abteilung" +i);
String emailPer = (String)request.getParameter("emailPer" +i);
String telPer = (String)request.getParameter("telPer" +i);
String mobil =(String)request.getParameter("mobil");
String fax = (String)request.getParameter("fax");
if (nachname == null) nachname = "";
if (vorname == null) vorname = "";
if (abteilung == null) abteilung = "";
if (emailPer == null) emailPer = "";
if (telPer == null) telPer = "";
if (mobil == null) mobil ="";
if (fax == null) fax
="";
%>
<table width="600" border="0">
<h4><font
color="#0000FF">Kontaktpersonen_<%= i
%>:</font></h4>
</table>
<%
%>
<table width="700" border="0">
<tr>
<td width="126"> Nachname: </td>
<td
width="148"><input type="text" name="nachname<%= i %>"
value="<%= nachname %>"/>
<input type="hidden" name = "showNachname" value="<%= i
%>"></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Vorname: </td>
<td
width="148"><input type="text" name="vorname<%= i %>"
value="<%= vorname %>"/>
<input type="hidden" name = "showVorname" value="<%= i
%>"></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Abteilung: </td>
<td
width="148"><input type="text" name="abteilung<%= i %>"
value="<%= abteilung %>"/>
<input type="hidden" name = "showAbteilung" value="<%= i
%>"> </td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Email: </td>
<td
width="448"><input type="text" name="emailPer<%= i %>"
size="25" value="<%= emailPer %>"/>
<font
color="#0000FF">Beispiel:
××××@tum.de</font>
<input
type="hidden" name = "showEmail" value="<%= i %>"></td>
<td width="112"></td>
</tr>
</table>
<!-- <table width="700" border="0">
<tr>
<td width="126"> TelNr.: </td>
<td
width="148"><input type="text" name="telPer<%//= i %>"
value="<%//= telPer %>"/>
<input type="hidden" name = "showTelPer" value="<%//= i
%>"></td>
<td
width="412"><font color="#0000FF">Bitte geben Sie nur die
Zahl, "-" oder "/".</font></td>
</tr>
</table>
-->
<table width="678" border="0">
<tr>
<td width="124"> TelNr.: </td>
<%
boolean tel = telPer.matches("[0-9]+");
if (( telPer.length() != 0) && ( tel == false )){
%>
<td width="144">
<input type="text" name="telPer<%= i %>" value=""/>
</td>
<td width="23"></td>
<td width="373">
<font
color="#FF0000">Bitte geben sie nur die Zähle
ein!</font></td>
<%
}else{
%>
<td
width="147"><input type="text" name="telPer<%= i %>"
value="<%= telPer %>"/>
<input type="hidden" name = "showTelPer" value="<%= i
%>"></td>
<td width="103"></td>
<td width= "290"></td>
<%
}
%>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Mobil.: </td>
<td
width="148"><input type="text" name="mobil<%= i %>"
value="<%= mobil %>"/>
<input type="hidden" name = "showMobil" value="<%= i
%>"></td>
<td
width="412"><font color="#0000FF"></font></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> FAX.: </td>
<td
width="148"><input type="text" name="fax<%= i %>"
value="<%= fax %>"/>
<input type="hidden" name = "showFax" value="<%= i
%>"></td>
<td
width="412"><font color="#0000FF"></font></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<!--in Datenbank
speichern##########################################################################-->
<%
}
}
} else{ anzahlSaveData = 1;
out.println("anzahlSaveData =" + anzahlSaveData);
%>
<!-- eine Link zur Datenbank -->
<h2><font color="#FF0000">Die Daten sind
schon in der Datenbank gespeichert</font></h2>
<%
}
%>
<td><input type = "button" name="submit" value="Speichern"
onclick="self.location.href='anbieterDB.jsp'" width=""
maxlength="40"/>
<input type="hidden" name = "nSaveData" value="<%= anzahlSaveData %>"/></td>
<td><input type = "button" name="close" value="Schliessen" />
<input type="hidden" name="nClose"
value="<%//= anzahlClose
%>"/></td>
<%
} else{
%>
<table width="600" border="0">
<tr>
<td><h2><font color="#0000FF">Anbieter</font></h2>
<%
if (nameAnbieter == null) nameAnbieter ="";
if (adresse == null) adresse = "";
if (plz == null) plz = "";
if (ort == null) ort = "";
if (land == null) land = "";
if (url == null) url ="";
if (emailAnbieter == null) emailAnbieter ="";
%>
<table width="700" border="0">
<tr>
<td width="126"> Name: </td>
<td
width="148"><input type="text" name="nameAnbieter" value="<%=
nameAnbieter %>" /></td>
<td
width="412"><!--<font color="#0000FF">Bitte geben Sie die
Zeichen nicht mehr als 50-stellige.</font>--></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Adresse: </td>
<td
width="148"><input type="text" name="adresse" value="<%=
adresse %>" /></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">PLZ:</td>
<td
width="148"><input type="text" name="plz" value="<%= plz
%>" /></td>
<td
width="412"><font color="#0000FF">Bitte geben Sie meisten
10-stellige Zahl.</font></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Ort:</td>
<td
width="148"><input type="text" name="ort" value="<%= ort
%>"/></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Land:</td>
<td
width="148"><input type="text" name="land" value="<%= land
%>" /></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Website/URL:</td>
<td
width="148"><input type="text" name="url" size="25" value="<%=
url %>" maxlength="100" /></td>
<td
width="412"><font color="#0000FF">Beispiel:
www.××××.com</font></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">eMail:</td>
<td
width="148"><input type="text" name="emailAnbieter" size="25"
value="<%= emailAnbieter %>" maxlength="100" /></td>
<td
width="412"><font color="#0000FF">Beispiel:
××××@tum.de</font></td>
</tr>
</table>
<table width="600" border="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<%
int anzahlPersonen = 0;
if (anzahlPersonenStr == null)
{anzahlPersonen = 0;
//out.println("anzahlPersonenErste= "+anzahlPersonen);
}
else {
anzahlPersonen = Integer.parseInt(anzahlPersonenStr, 10);
++anzahlPersonen;
//
out.println("anzahlPersonenZweit= "+anzahlPersonen);
for (int i = 1; i <= anzahlPersonen; ++i)
{
String nachname = (String)request.getParameter("nachname" + i);
String vorname = (String)request.getParameter("vorname" +i);
String abteilung = (String)request.getParameter("abteilung" +i);
String emailPer = (String)request.getParameter("emailPer" +i);
String telPer = (String)request.getParameter("telPer" +i);
String mobil =(String)request.getParameter("mobil");
String fax = (String)request.getParameter("fax");
if (nachname == null) nachname = "";
if (vorname == null) vorname = "";
if (abteilung == null) abteilung = "";
if (emailPer == null) emailPer = "";
if (telPer == null) telPer = "";
if (mobil == null) mobil ="";
if (fax == null) fax
="";
%>
<table width="600" border="0">
<h4><font
color="#0000FF">Kontaktpersonen_<%= i
%>:</font></h4>
</table>
<%
%>
<table width="700" border="0">
<tr>
<td width="126"> Nachname: </td>
<td
width="148"><input type="text" name="nachname<%= i %>"
value="<%= nachname %>"/>
<input type="hidden" name = "showNachname" value="<%= i
%>"></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Vorname: </td>
<td
width="148"><input type="text" name="vorname<%= i %>"
value="<%= vorname %>"/>
<input type="hidden" name = "showVorname" value="<%= i
%>"></td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Abteilung: </td>
<td
width="148"><input type="text" name="abteilung<%= i %>"
value="<%= abteilung %>"/>
<input type="hidden" name = "showAbteilung" value="<%= i
%>"> </td>
<td width="412"></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126">Email: </td>
<td
width="448"><input type="text" name="emailPer<%= i %>"
size="25" value="<%= emailPer %>"/>
<font
color="#0000FF">Beispiel:
××××@tum.de</font>
<input
type="hidden" name = "showEmail" value="<%= i %>"></td>
<td width="112"></td>
</tr>
</table>
<!-- <table width="700" border="0">
<tr>
<td width="126"> TelNr.: </td>
<td
width="148"><input type="text" name="telPer<%//= i %>"
value="<%//= telPer %>"/>
<input type="hidden" name = "showTelPer" value="<%//= i
%>"></td>
<td
width="412"><font color="#0000FF">Bitte geben Sie nur die
Zahl, "-" oder "/".</font></td>
</tr>
</table>
-->
<table width="678" border="0">
<tr>
<td width="124"> TelNr.: </td>
<%
boolean tel = telPer.matches("[0-9]+");
if (( telPer.length() != 0) && ( tel == false )){
%>
<td width="144">
<input type="text" name="telPer<%= i %>" value=""/>
</td>
<td width="23"></td>
<td width="373">
<font
color="#FF0000">Bitte geben sie nur die Zähle
ein!</font></td>
<%
}else{
%>
<td
width="147"><input type="text" name="telPer<%= i %>"
value="<%= telPer %>"/>
<input type="hidden" name = "showTelPer" value="<%= i
%>"></td>
<td width="103"></td>
<td width= "290"></td>
<%
}
%>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> Mobil.: </td>
<td
width="148"><input type="text" name="mobil<%= i %>"
value="<%= mobil %>"/>
<input type="hidden" name = "showMobil" value="<%= i
%>"></td>
<td
width="412"><font color="#0000FF"></font></td>
</tr>
</table>
<table width="700" border="0">
<tr>
<td width="126"> FAX.: </td>
<td
width="148"><input type="text" name="fax<%= i %>"
value="<%= fax %>"/>
<input type="hidden" name = "showFax" value="<%= i
%>"></td>
<td
width="412"><font color="#0000FF"></font></td>
</tr>
</table>
<!-- <table width="700" border="0">
<tr>
<td
width="100"><input type="submit" name="deletePersonal"
value="Kontaktperson Loeschen" /></td>
<td><input
type="hidden" name="nPersonMinus<%//= i %>" value="<%//=
anzahlPersonenMinus %>"></td>
<%//out.println("nPersonMinus_" + i ); %>
</tr>
</table>
-->
<table width="600" border="0">
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<%
}
}
%>
<table width="700" border="0">
<tr>
<td
width="100"><input type = "submit" name= "addPersonal "
value="Kontaktpersonen
hinzufuegen"/></td>
<td><input
type="hidden" name="nPerson" value="<%= anzahlPersonen
%>"></td>
<td>
<input type="submit" name="weiter" value="submit" />
</td>
</tr>
</table></td>
</tr>
</table>
<%
}
%>
</form>
</body>
</html>