Note that there are some explanatory texts on larger screens.

plurals
  1. POmap action with select tag in struts 2
    primarykey
    data
    text
    <pre><code> &lt;s:select name="country" list="countryList" listKey="countryId" listValue="countryName" headerKey="0" headerValue="Country" label="Select a country" /&gt; </code></pre> <p>country.java</p> <pre><code> package vaannila; public class Country { private int countryId; private String countryName; 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; } } </code></pre> <p>HelloWorld.java</p> <pre><code>public class HelloWorld { private String message; private String userName; private String gender; private boolean language; private ArrayList&lt;Country&gt; countryList; public HelloWorld(){ countryList = new ArrayList&lt;Country&gt;(); countryList.add(new Country(1, "India")); countryList.add(new Country(2, "USA")); countryList.add(new Country(3, "France")); } public boolean isLanguage() { return language; } public void setLanguage(boolean language) { this.language = language; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public ArrayList&lt;Country&gt; getCountryList() { return countryList; } public void setCountryList(ArrayList&lt;Country&gt; countryList) { this.countryList = countryList; } public String execute() { setMessage("Hello " + getUserName()); return "SUCCESS"; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } } </code></pre> <p>struts.xml</p> <pre><code>&lt;struts&gt; &lt;!-- Configuration for the default package. --&gt; &lt;package name="default" extends="struts-default"&gt; &lt;action name="HelloWorld" class="vaannila.HelloWorld"&gt; &lt;result name="SUCCESS"&gt;/success.jsp&lt;/result&gt; &lt;/action&gt; &lt;/package&gt; &lt;/struts&gt; </code></pre> <p>Http status 500</p> <p>org.apache.jasper.JasperException: tag 'select', field 'list', name 'country': The requested list key 'countryList' could not be resolved as a collection/array</p> <p>this is the error comming. can anyone help me</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload