I notice that you are using the # notation to access the property.  Does it 
work without it?  It seems like something is not available on the action.  You 
could add value="#diagnosisDTO.primaryDiagnosis" to your select and it will 
pull from the value stack just like the property did instead of searching your 
action, but your setup should work.  I believe there is just some other 
information we are missing as to why it is not functioning.

On Apr 1, 2017 11:56 PM, Kiran Kongala <kirankongal...@gmail.com> wrote:
Hi,

Before calling the return "success" in the action method I added couple of
println statements and I am seeing the data for the dropdown
 and below are the values

diseasetracking: DiseaseTracking: dstId = 20000048
DstCodeId = HPC
paID = 2
memberID = 100
memberIdentTypeID = 1
memberAddressID = 2
memberPhonePhoneID = 3
memberFaxPhoneID = 4
prescriberID = 100
prescriberIdentTypeID = 1
prescriberAddressID = 2
prescriberPhonePhoneID = 3
prescriberFaxPhoneID = 4
mdSpecialtyTypeID = 1
comments = null
startDate = 2017-03-31T00:20:13.729339
endDate = 9999-12-30T19:00
createdBy = 0
diagnosisDTO = DiagnosisDTO: primaryDiagnosis = 536
otherPrimaryDiagnosis = null
genoType = 541
otherGenoType = null
genoType2 = 675
otherGenoType2 = null
hivCoinfection = 551
renalImpairment = 555
otherRenalImpairment = null
postLiverTransplant = 559

diseasetracking DiagnosisDTO.PrimaryDiagnosis: 536

And I added this property <s:property
value="#diagnosisDTO.primaryDiagnosis"/>

but the value is not selected in the select tag.

And when I view the source, I am seeing the below source of the jsp
<select name="diagnosisDTO.primaryDiagnosis" size="1"
id="addEditHEPC_diagnosisDTO_primaryDiagnosis" class="form-control">
     <option value="-1"
     >Please Select</option>
     <option value="533">Chronic Hepatitis C</option>
     <option value="536">Chronic Hepatitis B</option>
     <option value="537">Chronic Hepatitis C and B</option>
     <option value="538">Acute Hepatitis C</option>
     <option value="539">Unknown / Not documented</option>
     <option value="540">Other</option>
 </select>

Everything looks correct but I am not seeing the value selected in the drop
down(536).

Thanks





On Sat, Apr 1, 2017 at 10:31 PM, Paul Zepernick <
paul.zepern...@healthsmart.com> wrote:

> What happens when you use a s:property to evaluate
> diagnosisDTO.primaryDiagnosis?  If you do not get a value, then check to
> make sure the path is right or that something is not wrong in your action
> that is populating it.  Also verify that the key property in your list is
> the same type as the value being set, both Integer for example.
>
> On Apr 1, 2017 7:38 PM, Kiran Kongala <kirankongal...@gmail.com> wrote:
> Hi,
>
> I am trying to use the Struts2 s:select tag but the drop down value coming
> from the db is not being set to the drop down as selected value and the
> screen always shows the default first value in the list.
>
> Can some one please help me.
>
> *JSP Code*
>
> <s:select name="diagnosisDTO.primaryDiagnosis"
>    list="primaryDiagnosisTypes"
>    listKey="dstLookupTypeId"
>    listValue="lookupValue"
>    multiple="false"
>    headerKey="-1"
>    headerValue="Please Select"
>    size="1"/>
>
> *Action Class Code*
>
>
> *I have Disease Tracking as a Model object and inside that model I have
> DiagnosisDTO object where I have properties which are matched  to the jsp
> select tag above*
>
>
>
>
> *This is the Model Object defined in the Action Class    public
> DiseaseTracking getModel() {        return this.diseasetracking;    }*
>
> *DiseaseTracking Object with DiagnosisDTO property below *
>
>
>
>
>
>
>
>
> *private DiagnosisDTO diagnosisDTO; public DiagnosisDTO getDiagnosisDTO()
> {  return diagnosisDTO; } public void setDiagnosisDTO(DiagnosisDTO
> diagnosisDTO) {  this.diagnosisDTO = diagnosisDTO; }*
>
>
> *DiagnosisDTO Object with property **primaryDiagnosis **and getter and
> setter*
>
>
>
>
> * private int primaryDiagnosis; public int getPrimaryDiagnosis() {  return
> primaryDiagnosis; }*
>
>
>
>
> * public void setPrimaryDiagnosis(int primaryDiagnosis)
> {  this.primaryDiagnosis = primaryDiagnosis; }*
>
>
> *This method is a service call to get the disease tracking object*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> * public String getHepC() throws Exception {  List allDstLookupTypes =
> GenCache.getListOfDstLookupType(user.getCurrentClientId());
>  setPrimaryDiagnosisTypes(this.getSpecificDstLookupTypes(
> Constants.DST_LOOKUP_GRP_CODE_ID_PRD,
> allDstLookupTypes));  DiseaseTrackingDelegate dstDelegate = new
> DiseaseTrackingDelegate();  int dstId = 20000048;  //The below is the
> service call to db which will get the disease tracking object with some
> lists objects.   diseasetracking =
> dstDelegate.getDSTById(user.getCurrentClientId(), dstId, null);  //the
> below is the code to convert the list returned from service to another
> object Diagnosis DTO and set that back to Disease Tracking model
> object  convertDiagnosisListToDiagnosisDTO(diseasetracking.
> getAlDstLookup());
>  return
> "success"; } public List<DstLookupType> getSpecificDstLookupTypes(String
> grpLookupTypeId, List<DstLookupType>
> allDstLookupTypes){ List<DstLookupType> lookupTypes = new
> ArrayList<DstLookupType>(); for(int i=0; i <
> allDstLookupTypes.size();i++) {  if(
> allDstLookupTypes.get(i).getDstLookupGrpCodeId().equals(grpLookupTypeId)){
>   lookupTypes.add(allDstLookupTypes.get(i));  } } return
> lookupTypes;}*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *    public void convertDiagnosisListToDiagnosisDTO(List<DSTLookupDTO>
> alDstLookup) throws CpsEntException {     DiagnosisDTO dt = null;
> try {         if(alDstLookup != null && alDstLookup.size() != 0)
>  {          dt = new DiagnosisDTO();          for (final DSTLookupDTO
> dstLookup : alDstLookup) {
>    if(dstLookup.getDstLookupGrpCodeId().equals(Constants.DST_LOOKUP_
> GRP_CODE_ID_PRD))
>    {            dt.setPdDstLookupId(dstLookup.getDstLookupId());
>     //dt.setPrimaryDiagnosis(dstLookup.getDstLookupTypeId());
>     diseasetracking.setPrimaryDiagnosis(dstLookup.getDstLookupTypeId());
>     dt.setPdDstSubModuleRowId(dstLookup.getDstSubModuleRowId());
>     dt.setOtherPrimaryDiagnosis(dstLookup.getOtherValue());
>    }           else
> if(dstLookup.getDstLookupGrpCodeId().equals(Constants.DST_LOOKUP_
> GRP_CODE_ID_GNT))
>    {
>     dt.setGenoTypeDstLookupId(dstLookup.getDstLookupId());
>     dt.setGenoType(dstLookup.getDstLookupTypeId());
>     dt.setGenoTypeDstSubModuleRowId(dstLookup.getDstSubModuleRowId());
>     dt.setOtherGenoType(dstLookup.getOtherValue());           }
>    else
> if(dstLookup.getDstLookupGrpCodeId().equals(Constants.DST_LOOKUP_
> GRP_CODE_ID_GNT2))
>    {
>     dt.setGenoType2DstLookupId(dstLookup.getDstLookupId());
>     dt.setGenoType2(dstLookup.getDstLookupTypeId());
>     dt.setGenoType2DstSubModuleRowId(dstLookup.getDstSubModuleRowId());
>     dt.setOtherGenoType2(dstLookup.getOtherValue());           }
>    else
> if(dstLookup.getDstLookupGrpCodeId().equals(Constants.DST_LOOKUP_
> GRP_CODE_ID_HVC))
>    {            dt.setHivDstLookupId(dstLookup.getDstLookupId());
>     dt.setHivCoinfection(dstLookup.getDstLookupTypeId());
>     dt.setHivDstSubModuleRowId(dstLookup.getDstSubModuleRowId());
>    }           else
> if(dstLookup.getDstLookupGrpCodeId().equals(Constants.DST_LOOKUP_
> GRP_CODE_ID_RNI))
>    {            dt.setRenalDstLookupId(dstLookup.getDstLookupId());
>     dt.setRenalImpairment(dstLookup.getDstLookupTypeId());
>     dt.setRenalDstSubModuleRowId(dstLookup.getDstSubModuleRowId());
>     dt.setOtherRenalImpairment(dstLookup.getOtherValue());
>    }           else
> if(dstLookup.getDstLookupGrpCodeId().equals(Constants.DST_LOOKUP_
> GRP_CODE_ID_SPLT))
>    {
>     dt.setPostLiverDstLookupId(dstLookup.getDstLookupId());
>     dt.setPostLiverTransplant(dstLookup.getDstLookupTypeId());
>     dt.setPostLiverDstSubModuleRowId(dstLookup.getDstSubModuleRowId());
>    }          }         }        } catch (Exception e) {
> e.printStackTrace();            throw new
> CpsEntException(e.getMessage());        }
> diseasetracking.setDiagnosisDTO(dt);    } *
>
> Thanks
>
>
>
>
> Disclaimer: This communication and any files transmitted with it may
> contain information that is privileged, confidential and/or exempt from
> disclosure under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or use of
> the information contained herein (including any reliance thereon) is
> strictly prohibited. If you received this communication in error, please
> immediately contact the sender and destroy the material in its entirety,
> whether in electronic or hard copy format. Thank you.
>




Disclaimer: This communication and any files transmitted with it may contain 
information that is privileged, confidential and/or exempt from disclosure 
under applicable law. If you are not the intended recipient, you are hereby 
notified that any disclosure, copying, distribution, or use of the information 
contained herein (including any reliance thereon) is strictly prohibited. If 
you received this communication in error, please immediately contact the sender 
and destroy the material in its entirety, whether in electronic or hard copy 
format. Thank you.

Reply via email to