RE: Struts 2.5 upgrade clarification

2018-12-27 Thread David Dillard
Independent of Struts requirements, you should upgrade as Java 6 is no longer 
receiving updates (not even under a support contract).

https://www.oracle.com/technetwork/java/java-se-support-roadmap.html
https://www.oracle.com/support/lifetime-support/



-Original Message-
From: Gopal, Siva Prakash (US - Mechanicsburg Delivery)  
Sent: Thursday, December 27, 2018 2:09 PM
To: Struts Users Mailing List 
Subject: [EXTERNAL] Struts 2.5 upgrade clarification

Hi Team,

We are upgrading our struts version from 2.3 to 2.5. currently we are using 
Java version 1.6. Do we need upgrade java version as part of struts upgrade

Thanks,
Siva

This message (including any attachments) contains confidential information 
intended for a specific individual and purpose, and is protected by law. If you 
are not the intended recipient, you should delete this message and any 
disclosure, copying, or distribution of this message, or the taking of any 
action based on it, by you is strictly prohibited.

v.E.1

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts 2.5 upgrade clarification

2018-12-27 Thread Gopal, Siva Prakash (US - Mechanicsburg Delivery)
Hi Team,

We are upgrading our struts version from 2.3 to 2.5. currently we are using 
Java version 1.6. Do we need upgrade java version as part of struts upgrade

Thanks,
Siva

This message (including any attachments) contains confidential information 
intended for a specific individual and purpose, and is protected by law. If you 
are not the intended recipient, you should delete this message and any 
disclosure, copying, or distribution of this message, or the taking of any 
action based on it, by you is strictly prohibited.

v.E.1


Re: How to display both selected key and value of s:select

2018-12-27 Thread albert kao
Hi Yasser,

Thanks for your useful suggestion!
It works with:
public class RegisterAction {
...
   public Country getSelectedCountryObject(String selectedCountry) {
  for (Country c : countryList) {
 if (String.valueOf(c.getCountryId()).equals(selectedCountry))
return c;
  }
  return new Country(0, "");
   }
...
}



On Mon, Dec 24, 2018 at 3:00 AM Yasser Zamani 
wrote:

> Hi Albert,
>
> The simplest method can be something like this:
>
> public class RegisterAction {
> ...
> public Country getSelectedCountryObject() {
> foreach (c in countryList) if(c.countryId==selectedCountry) return c;
> }
> ...
> }
>
> 
>
> Thanks for using Struts.
>
> Kind Regards.
>
> >-Original Message-
> >From: albert kao 
> >Sent: Saturday, December 22, 2018 6:39 PM
> >To: Struts Users Mailing List 
> >Subject: How to display both selected key and value of s:select
> >
> >I want to display both selected key and value of s:select.
> >e.g. for the following codes, after I select key="2", value="Canada"
> >and press the submit button.
> >Only the key "Country: 2" is displayed in the registerResult.jsp as
> desired.
> >How to make the value "Canada" to display also in the browser?
> >
> >public class RegisterAction extends ActionSupport { private String
> country,
> >selectedCountry; private ArrayList countryList;
> >
> >public RegisterAction() {
> >countryList = new ArrayList();
> >countryList.add(new Country(1, "India")); countryList.add(new Country(2,
> >"Canada")); countryList.add(new Country(3, "US")); return; } }
> >
> >public class Country {
> >private int countryId;
> >private String countryName;
> >public Country(int countryId, String countryName) { this.countryId =
> countryId;
> >this.countryName = countryName; } public int getCountryId() { return
> countryId; }
> >public void setCountryId(int countryId) { this.countryId = countryId; }
> public String
> >getCountryName() { return countryName; } public void setCountryName(String
> >countryName) { this.countryName = countryName; } }
> >
> >register.jsp
> >
> >
> > >listValue="countryName"
> >value="selectedCountry"
> >headerKey="0" headerValue="Country"
> >label="Select a country" />
> >
> >
> >
> >
> >
> >registerResult.jsp
> >Country:  selectedCountry:
> > CountryListAll:  >value="getCountryList()" /> CountryListAll2:  >value="countryList" /> CountryList:  >value="getCountryList().get(country)" /> CountryList.get  >value="countryList.get(country)" />
> >
> >
> >http://localhost:8080/Struts2Example/register.action
> >Country: 2
> >selectedCountry: CountryListAll: [com.test.common.Country@32cdbdf6,
> >com.test.common.Country@6cbe3d89, com.test.common.Country@7abf043f]
> >CountryListAll2: [com.test.common.Country@32cdbdf6,
> >com.test.common.Country@6cbe3d89, com.test.common.Country@7abf043f]
> >CountryList: com.test.common.Country@7abf043f CountryList.get
> >com.test.common.Country@7abf043f
>