Quantcast

Issue with Struts2 s:select tag with Object inside a Model Object

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue with Struts2 s:select tag with Object inside a Model Object

Kiran Kongala
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Paul Zepernick
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 <[hidden email]> 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Kiran Kongala
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 <
[hidden email]> 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 <[hidden email]> 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.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Lukasz Lenart
Did you implement hashCode and equals? You are comparing objects not Strings


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2017-04-02 5:55 GMT+02:00 Kiran Kongala <[hidden email]>:

> 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 <
> [hidden email]> 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 <[hidden email]> 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.
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Paul Zepernick
In reply to this post by Kiran Kongala
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 <[hidden email]> 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 <
[hidden email]> 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 <[hidden email]> 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Kiran Kongala
Hi Lulasz,

I am not comparing the same objects.I am trying to compare the String to a constant String.
Still do I need to override the equals and hashCode methods.
I added a <s:debug/> tag in the jsp and I see the values.
But the value doesnt set the value back to the s:select drop down list.

The below are the three classes being used in the code other than the Model(DiseaseTracking)
From the Service class, I have the list of DSTLookupDTO objects with dstLookupId as the int value.
I loop through the list and if a string value matches a constant string value, I add the dstLookupId value to the primaryDiagnosis property of the DiagnosisDTO object and I set that object to the DiseaseTracking model object. I have similar conditions for other properties.

public class DSTLookupDTO implements Serializable {
 private int dstLookupId;
 public DSTLookupDTO()
 {
 }
 //Has proper setter and getter methods for the properties
}
public class DiagnosisDTO implements Serializable {
    private int primaryDiagnosis;
    //Has proper setter and getter methods for the properties
}
public class DstLookupType implements DataValidation, Cloneable,Serializable
{
 private String dstLookupTypeId = "";
 private String lookupValue = "";
 //Has proper setter and getter methods for the properties
}


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) {
   String grpCodeId = dstLookup.getDstLookupGrpCodeId();
   if(grpCodeId.equals(Constants.DST_LOOKUP_GRP_CODE_ID_PRD))
   {
    dt.setPdDstLookupId(dstLookup.getDstLookupId());
    dt.setPrimaryDiagnosis(dstLookup.getDstLookupTypeId());
    dt.setPdDstSubModuleRowId(dstLookup.getDstSubModuleRowId());
    dt.setOtherPrimaryDiagnosis(dstLookup.getOtherValue());
   }
   else if(grpCodeId.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(grpCodeId.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(grpCodeId.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(grpCodeId.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);
}
   
   
public String getHepC() throws Exception {
 setAllLookups();
 DiseaseTrackingDelegate dstDelegate = new DiseaseTrackingDelegate();
 int dstId = 20000048;
 diseasetracking = dstDelegate.getDSTById(user.getCurrentClientId(), dstId, null);
 convertDiagnosisListToDiagnosisDTO(diseasetracking.getAlDstLookup());
 System.out.println("diseasetracking: "+diseasetracking);
 System.out.println("diseasetracking DiagnosisDTO.PrimaryDiagnosis: "+diseasetracking.getDiagnosisDTO().getPrimaryDiagnosis());
 return "success";
}

I don't know even if the value of the select drop down matches (536), the option is not selected.

Below is the debug information of value stack.


Thanks 

On Sun, Apr 2, 2017 at 2:31 PM, Paul Zepernick <[hidden email]> wrote:
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 <[hidden email]> 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 <
[hidden email]> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Kiran Kongala
In reply to this post by Paul Zepernick
Hi Paul,
I added as you said in the jsp with value.
           <s:select id="diagnosisDTO.primaryDiagnosis"
name="diagnosisDTO.primaryDiagnosis" value="#diagnosisDTO.primaryDiagnosis"
                     list="primaryDiagnosisTypes"
                     listKey="dstLookupTypeId"
                     listValue="lookupValue"
                     multiple="false"
                     headerKey="-1"
                     headerValue="Please Select"
                     size="1"/>

And below is the view source code for the drop down. But I don't see the
536 option as selected.
I can see that value in the value stack as shown in the previous
email.
<select name="diagnosisDTO.primaryDiagnosis" size="1"
id="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>

On Sun, Apr 2, 2017 at 2:31 PM, Paul Zepernick <
[hidden email]> wrote:

> 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 <[hidden email]> 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 <
> [hidden email]> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Lukasz Lenart
In reply to this post by Kiran Kongala
2017-04-02 22:58 GMT+02:00 Kiran Kongala <[hidden email]>:

> Hi Lulasz,
>
>
> *I am not comparing the same objects.I am trying to compare the String to
> a constant String.Still do I need to override the equals and hashCode
> methods.*
>
> *I added a <s:debug/> tag in the jsp and I see the values.But the value
> doesnt set the value back to the s:select drop down list.*
>

If you are comparing Strings why do use listKey and listValue? These
attributes are used to fetch an object's property and compare it with value
pointed by the "name" attribute.


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Kiran Kongala
Hi Lukasz,

Thank you for helping. I am new to Struts2. What are the other attributes I need to use if not listkey and listvalue.
In my example, I defined the select as below with name as diagnosisDTO.primaryDiagnosis and list as primaryDiagnosisTypes which is an object which has dstLookupTypeID as key and lookupValue as the value.
I am thinking the listkey is compared with the value pointed by the name attribute.
For eg: If I have the diagnosistypes list has an object with key as '536' and the value as 'Chronic Hepatitis B' and if I get the '536' from the service in action and if I assign that value to 'diagnosisDTO.primaryDiagnosis' name in the action model, I thought it will pick that value as selected. If I remove the listKey and list Value from the s:select tag, I am getting the complete object in the drop down as below. Please correct me if I am wrong.

name="diagnosisDTO.primaryDiagnosis"

list="primaryDiagnosisTypes"

listKey="dstLookupTypeId"

listValue="lookupValue"





Thanks



On Mon, Apr 3, 2017 at 6:44 AM, Lukasz Lenart <[hidden email]> wrote:
2017-04-02 22:58 GMT+02:00 Kiran Kongala <[hidden email]>:

> Hi Lulasz,
>
>
> *I am not comparing the same objects.I am trying to compare the String to
> a constant String.Still do I need to override the equals and hashCode
> methods.*
>
> *I added a <s:debug/> tag in the jsp and I see the values.But the value
> doesnt set the value back to the s:select drop down list.*
>

If you are comparing Strings why do use listKey and listValue? These
attributes are used to fetch an object's property and compare it with value
pointed by the "name" attribute.


Regards
--
Łukasz
<a href="tel:%2B%2048%20606%20323%20122" value="+48606323122">+ 48 606 323 122 http://www.lenart.org.pl/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Lukasz Lenart
2017-04-03 16:04 GMT+02:00 Kiran Kongala <[hidden email]>:
>
> listKey=*"dstLookupTypeId"*
>
Do you have a getter for this value? getDstLookupTypeId() ?

> listValue=*"lookupValue"*
>
Same here, do you have a getter? getLookupValue() ?


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

PS. Do not inline screenshots, they won't be visible
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with Struts2 s:select tag with Object inside a Model Object

Kiran Kongala
Thank you Lucasz for looking into this. Yes I Have all the setter and getter for all the properties. Its working now. I just need to give the whole path of the property in the s:select value attribute.
Like value="%{diseasetracking.diagnosisDTO.primaryDiagnosis}"
Because I have the property in the diagnosisDTO object which is in the diseasetracking model object, if I give the complete path of the property, its working now.

Thank you all for looking at my issue.
Kiran

> On Apr 3, 2017, at 2:25 PM, Lukasz Lenart <[hidden email]> wrote:
>
> 2017-04-03 16:04 GMT+02:00 Kiran Kongala <[hidden email]>:
>>
>> listKey=*"dstLookupTypeId"*
>>
> Do you have a getter for this value? getDstLookupTypeId() ?
>
>> listValue=*"lookupValue"*
>>
> Same here, do you have a getter? getLookupValue() ?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> PS. Do not inline screenshots, they won't be visible

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...