Parent State Field

This commit is contained in:
Daniel.ryan@glowtouch.com 2017-06-19 14:10:35 -04:00
parent eb611d72bc
commit c0bd8be986
6 changed files with 35 additions and 14 deletions

View file

@ -53,6 +53,10 @@ public class Parent extends Person {
@NotEmpty @NotEmpty
private String city; private String city;
@Column(name = "state")
@NotEmpty
private String state;
@Column(name = "telephone") @Column(name = "telephone")
@NotEmpty @NotEmpty
@Digits(fraction = 0, integer = 10) @Digits(fraction = 0, integer = 10)
@ -78,6 +82,14 @@ public class Parent extends Person {
this.city = city; this.city = city;
} }
public String getState(){
return this.state;
}
public void setState(String state){
this.state = state;
}
public String getTelephone() { public String getTelephone() {
return this.telephone; return this.telephone;
} }

View file

@ -19,16 +19,16 @@ INSERT INTO gender VALUES (1, 'Male');
INSERT INTO gender VALUES (2, 'Female'); INSERT INTO gender VALUES (2, 'Female');
INSERT INTO parents VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023'); INSERT INTO parents VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', 'WI', '6085551023');
INSERT INTO parents VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749'); INSERT INTO parents VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', 'WI', '6085551749');
INSERT INTO parents VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763'); INSERT INTO parents VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', 'AZ', '6085558763');
INSERT INTO parents VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198'); INSERT INTO parents VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', 'CO', '6085553198');
INSERT INTO parents VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765'); INSERT INTO parents VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', 'WI', '6085552765');
INSERT INTO parents VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654'); INSERT INTO parents VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', 'WI', '6085552654');
INSERT INTO parents VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387'); INSERT INTO parents VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', 'WI', '6085555387');
INSERT INTO parents VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683'); INSERT INTO parents VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', 'WI', '6085557683');
INSERT INTO parents VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435'); INSERT INTO parents VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', 'WI', '6085559435');
INSERT INTO parents VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487'); INSERT INTO parents VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', 'WI', '6085555487');
INSERT INTO kids VALUES (1, 'Alyssa', '2000-09-07', 2, 1, 'Claritin', 'None'); INSERT INTO kids VALUES (1, 'Alyssa', '2000-09-07', 2, 1, 'Claritin', 'None');
INSERT INTO kids VALUES (2, 'Joe', '2002-08-06', 1, 2, 'None', 'Lipitor'); INSERT INTO kids VALUES (2, 'Joe', '2002-08-06', 1, 2, 'None', 'Lipitor');

View file

@ -39,6 +39,7 @@ CREATE TABLE parents (
last_name VARCHAR_IGNORECASE(30), last_name VARCHAR_IGNORECASE(30),
address VARCHAR(255), address VARCHAR(255),
city VARCHAR(80), city VARCHAR(80),
state VARCHAR(30),
telephone VARCHAR(20) telephone VARCHAR(20)
); );
CREATE INDEX parents_last_name ON parents (last_name); CREATE INDEX parents_last_name ON parents (last_name);

View file

@ -14,6 +14,8 @@
th:replace="~{fragments/inputField :: input ('Address', 'address')}" /> th:replace="~{fragments/inputField :: input ('Address', 'address')}" />
<input <input
th:replace="~{fragments/inputField :: input ('City', 'city')}" /> th:replace="~{fragments/inputField :: input ('City', 'city')}" />
<input
th:replace="~{fragments/inputField :: input ('State', 'state')}" />
<input <input
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" /> th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" />
</div> </div>

View file

@ -22,6 +22,10 @@
<th>City</th> <th>City</th>
<td th:text="*{city}" /></td> <td th:text="*{city}" /></td>
</tr> </tr>
<tr>
<th>State</th>
<td th:text="*{state}" /></td>
</tr>
<tr> <tr>
<th>Telephone</th> <th>Telephone</th>
<td th:text="*{telephone}" /></td> <td th:text="*{telephone}" /></td>

View file

@ -11,9 +11,10 @@
<tr> <tr>
<th style="width: 150px;">Name</th> <th style="width: 150px;">Name</th>
<th style="width: 200px;">Address</th> <th style="width: 200px;">Address</th>
<th>City</th> <th style="width: 150px;">City</th>
<th style="width: 120px">Telephone</th> <th style="width: 150px;">State</th>
<th>Children</th> <th style="width: 120px;">Telephone</th>
<th style="width: 150px;">Children</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -23,6 +24,7 @@
</td> </td>
<td th:text="${parent.address}"/> <td th:text="${parent.address}"/>
<td th:text="${parent.city}"/> <td th:text="${parent.city}"/>
<td th:text="${parent.state}"/>
<td th:text="${parent.telephone}"/> <td th:text="${parent.telephone}"/>
<td><span th:each="kid : ${parent.kids}" th:text="${kid.name} + ' '"/></td> <td><span th:each="kid : ${parent.kids}" th:text="${kid.name} + ' '"/></td>
</tr> </tr>