There are two main considerations:
1. the data structure that stores the schools and subschools
2. the way to interact with the user.
1. The data structure.
Using enums is among a number of solutions including the use of Maps and Arrays. If you want to use enums you could nest the sub school as an enum with in the definition of the school.
For example:
public enum School {
ABJURATION("Abjuration", SubSchools.SUBSCHOOL1),
CONJURATION("Conjuration");
private final String name;
private final SubSchools SubSchoolEnum;
School(String name){
this.name = name;
this.SubSchoolEnum = null;
}
School(String name, SubSchools SubSchoolEnum){
this.name = name;
this.SubSchoolEnum = SubSchoolEnum;
}
SubSchool is the nested enum:
public enum SubSchools {
SUBSCHOOL1(new String[]{"qqqq","wwww","eee"});
private final String[] SchoolList;
SubSchools(String[] SchoolList){
this.SchoolList = SchoolList;
}
public String[] getSchools(){
return this.SchoolList;
}
}
With this data structure you can retrieve a list of enum in School using the values() method: SubSchools subSchool = school.getSubSchool(); and loop through the enum in school.
If you add the following methods to School enum you can retrieve data about each school:
public SubSchools getSubSchool(){
return this.SubSchoolEnum;
}
public String getName(){
return this.name;
}
This data structure can be used to firstly retrieve the list of school that populate the first drop down and then when the user selects an option the subschools can be retrieved.
2. Interact with the user.
This can be done with a combinations of a servlet on the server side and HTML/JAVASCRIPT/AJAX on the client side.
The servlet is in charge of retrieving the data and sending it to the user, while the HTML displays the dropdown and the Ajax sends the selected option to the servlet which obtains the subschools and sends them in a response to the page which displays the dropdown with the subschool options.
Theres a lot of work to do here but all the info you need is on the net and there are lots of videos in youtube. Search for using servlets and ajax. Heres a
link to get you started.