Ric.hard
Jun 4th, 2006, 11:17 AM
hi guys,
heres my code for my referencedata. I have been able to display my dynamic content with no problems but how do i make sure that the session is empty and the attributes countries and states are empty everytime i enter the first page, BUT not to be emptied when I click the back button ( _target0 btn ).
please advise.
thanks
richard
protected Map referenceData(HttpServletRequest request, int page) {
Map refData = new HashMap();
switch (page) {
case 0:
List list = ( List ) this.phonePlansDao.getInternationalPhonePlans();
List list2 = ( List ) this.phonePlansDao.getUSCPhonePlans();
refData.put("internationalPhonePlans", list);
refData.put("usPhonePlans", list2);
break;
case 1:
refData.put("countries", this.getCountries());
String currCountry = this.getSelectedCountry() ;
Country selectedCountry = null;
if ( currCountry != null ){
selectedCountry = this.getCountry( this.getSelectedCountry() ) ;
if ( selectedCountry != null ){
HashSet states = (HashSet) selectedCountry.getStateProvinceRegion() ;
refData.put("states", states);
}
}
String currState = this.getSelectedState();
StateProvinceRegion selectedState = null ;
if ( currState != null ){
selectedState = this.getState( selectedCountry, this.getSelectedState() );
if ( selectedState != null ){
HashSet areaCodes = ( HashSet) selectedState.getAreaCodes();
refData.put("areaCodes", areaCodes);
}
}
String currAC = this.getSelectedAreaCode();
AreaCode currACObj = null;
if ( currAC != null ){
currACObj = this.getAreaCode( selectedState,currAC ) ;
if ( currACObj != null ){
HashSet XCodes = ( HashSet) currACObj.getExchangeCodes();
refData.put("XCodes", XCodes);
}
}
break;
}
return refData;
heres my code for my referencedata. I have been able to display my dynamic content with no problems but how do i make sure that the session is empty and the attributes countries and states are empty everytime i enter the first page, BUT not to be emptied when I click the back button ( _target0 btn ).
please advise.
thanks
richard
protected Map referenceData(HttpServletRequest request, int page) {
Map refData = new HashMap();
switch (page) {
case 0:
List list = ( List ) this.phonePlansDao.getInternationalPhonePlans();
List list2 = ( List ) this.phonePlansDao.getUSCPhonePlans();
refData.put("internationalPhonePlans", list);
refData.put("usPhonePlans", list2);
break;
case 1:
refData.put("countries", this.getCountries());
String currCountry = this.getSelectedCountry() ;
Country selectedCountry = null;
if ( currCountry != null ){
selectedCountry = this.getCountry( this.getSelectedCountry() ) ;
if ( selectedCountry != null ){
HashSet states = (HashSet) selectedCountry.getStateProvinceRegion() ;
refData.put("states", states);
}
}
String currState = this.getSelectedState();
StateProvinceRegion selectedState = null ;
if ( currState != null ){
selectedState = this.getState( selectedCountry, this.getSelectedState() );
if ( selectedState != null ){
HashSet areaCodes = ( HashSet) selectedState.getAreaCodes();
refData.put("areaCodes", areaCodes);
}
}
String currAC = this.getSelectedAreaCode();
AreaCode currACObj = null;
if ( currAC != null ){
currACObj = this.getAreaCode( selectedState,currAC ) ;
if ( currACObj != null ){
HashSet XCodes = ( HashSet) currACObj.getExchangeCodes();
refData.put("XCodes", XCodes);
}
}
break;
}
return refData;