Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I want to see struts.xml as well as the properties file. please put the code.</p> <p>EDIT: Ok, so what i understood from your edit is that you have to return a list (as you do in java) instead of string from the action class. If yes you can not do so. However,use struts-2-json plugin to return json objects to the view. </p> <p><a href="http://www.mkyong.com/struts2/struts-2-and-json-example/" rel="nofollow noreferrer">http://www.mkyong.com/struts2/struts-2-and-json-example/</a></p> <p>Also , it does not matter what type of data is returned by your action method as you can only return string but what attributes you set in your action class. So, the attributes set in action class will be accessible in your view &amp; for List(set in action class) you will have to use iterator.</p> <p>Moreover if you have just stated with struts2 I will recommend you understand the MVC &amp; role of getters &amp; setters in it.</p> <p><a href="https://stackoverflow.com/questions/1184702/can-i-use-mvc-without-getters-and-setters">Can I use mvc without getters and setters?</a></p> <p>Thanks for the input, if you get error then also you should return a string. with that string the mapped error page in struts.xml will be shown. For eg. while processing data you found it inconsistent then you can return a string "error" and in struts it appears as</p> <pre><code>&lt;action name="yourAction" class="action.Action"&gt; &lt;result name="error"&gt;/Error.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p>And for exception handling which is what you should be looking for or will soon you can go to the link below <a href="http://struts.apache.org/release/2.3.x/docs/exception-handling.html" rel="nofollow noreferrer">http://struts.apache.org/release/2.3.x/docs/exception-handling.html</a></p> <p>Please tell me if I answered your question.</p>
    singulars
    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.
    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