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

2017-04-03 Thread Kiran
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  wrote:
> 
> 2017-04-03 16:04 GMT+02:00 Kiran Kongala :
>> 
>> 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: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



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

2017-04-03 Thread Lukasz Lenart
2017-04-03 16:04 GMT+02:00 Kiran Kongala :
>
> 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


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

2017-04-03 Thread 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[image: Inline image 1]*


On Mon, Apr 3, 2017 at 6:44 AM, Lukasz Lenart 
wrote:

> 2017-04-02 22:58 GMT+02:00 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  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/
>


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

2017-04-03 Thread Lukasz Lenart
2017-04-02 22:58 GMT+02:00 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  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/


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

2017-04-02 Thread Kiran Kongala
Hi Paul,
I added as you said in the jsp with value.
   

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.

Please Select
Chronic Hepatitis C
Chronic Hepatitis B
Chronic Hepatitis C and B
Acute Hepatitis C
Unknown / Not documented
Other



On Sun, Apr 2, 2017 at 2:31 PM, Paul Zepernick <
paul.zepern...@healthsmart.com> 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  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 = 2048
> 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 = -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  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
>  id="addEditHEPC_diagnosisDTO_primaryDiagnosis" class="form-control">
>>Please Select
>  Chronic Hepatitis C
>  Chronic Hepatitis B
>  Chronic Hepatitis C and B
>  Acute Hepatitis C
>  Unknown / Not documented
>  Other
>  
>
> 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  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*
> >
> >  >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 Classpublic
> > 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(
> > 

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

2017-04-02 Thread 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  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
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 = 2048;
 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.

[image: Inline image 1]

Thanks

On Sun, Apr 2, 2017 at 2:31 PM, Paul Zepernick <
paul.zepern...@healthsmart.com> 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  wrote:
> Hi,
>
> Before calling the return "success" in the action method I added couple of
> println statements and I am 

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

2017-04-02 Thread Paul Zepernick
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  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 = 2048
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 = -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 

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

 Please Select
 Chronic Hepatitis C
 Chronic Hepatitis B
 Chronic Hepatitis C and B
 Acute Hepatitis C
 Unknown / Not documented
 Other
 

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  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*
>
> 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 Classpublic
> 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 = 2048;  //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 getSpecificDstLookupTypes(String
> grpLookupTypeId, List
> allDstLookupTypes){ List lookupTypes = new
> ArrayList(); for(int i=0; i <
> allDstLookupTypes.size();i++) {  if(
> allDstLookupTypes.get(i).getDstLookupGrpCodeId().equals(grpLookupTypeId)){
>   lookupTypes.add(allDstLookupTypes.get(i));  } } return
> lookupTypes;}*
>
>
>
>

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

2017-04-02 Thread 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 :
> 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 = 2048
> 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 = -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  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
>
>  id="addEditHEPC_diagnosisDTO_primaryDiagnosis" class="form-control">
>>Please Select
>  Chronic Hepatitis C
>  Chronic Hepatitis B
>  Chronic Hepatitis C and B
>  Acute Hepatitis C
>  Unknown / Not documented
>  Other
>  
>
> 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  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*
>>
>> >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 Classpublic
>> 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 = 2048;  //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 getSpecificDstLookupTypes(String
>> grpLookupTypeId, List
>> allDstLookupTypes){ List lookupTypes = new
>> ArrayList(); for(int i=0; i <
>> allDstLookupTypes.size();i++) {  if(
>> allDstLookupTypes.get(i).getDstLookupGrpCodeId().equals(grpLookupTypeId)){
>>   lookupTypes.add(allDstLookupTypes.get(i));  

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

2017-04-01 Thread 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 = 2048
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 = -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 

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


 Please Select
 Chronic Hepatitis C
 Chronic Hepatitis B
 Chronic Hepatitis C and B
 Acute Hepatitis C
 Unknown / Not documented
 Other
 

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  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*
>
> 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 Classpublic
> 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 = 2048;  //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 getSpecificDstLookupTypes(String
> grpLookupTypeId, List
> allDstLookupTypes){ List lookupTypes = new
> ArrayList(); 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
> 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))
>{

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

2017-04-01 Thread 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  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*



*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 Classpublic
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 = 2048;  //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 getSpecificDstLookupTypes(String
grpLookupTypeId, List
allDstLookupTypes){ List lookupTypes = new
ArrayList(); 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
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());