Note that there are some explanatory texts on larger screens.

plurals
  1. POstruts2 configuration requires input?
    primarykey
    data
    text
    <p>In my project, I have this config in <code>struts.xml</code></p> <pre><code>&lt;action name="searchTracker" class="searchAction" method="searchTracker"&gt; &lt;result name="success"&gt;/jsp/searchTracker.jsp&lt;/result&gt; &lt;result name="error"&gt;/jsp/searchTracker.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p>And here is my action method in searchAction Action</p> <pre><code>public String searchTracker(){ this.clearErrorsAndMessages(); List&lt;File&gt; queryResults = fileManager.retrievequeryResults(patchNumBySearch); // patchNumBySearchis input from the page if(queryResults == null){ this.setTrackers(null); addActionError("This patch number doesn't exist. Please choose another one !"); return ERROR; } List&lt;Tracker&gt; trackers = commonUtils.convertToTrackers(queryResults); this.setTrackers(trackers); } return SUCCESS; </code></pre> <p>}</p> <p>if I input wrong param and the <code>queryResult</code> is returned as <code>NULL</code>, the page <code>searchTracker.jsp</code> can correctly show error message in itself as I wish, but after this, I enter correct param, it show error directly below</p> <pre><code> "Errors on action com.harris.northstar.dbadesk.action.SearchTrackerAction@9bee3a, returning result name 'input'" </code></pre> <p>I just compared debug log in two different case, and found that only one line difference</p> <pre><code> "converter is null for property patchNumBySearch. Mapping size: 0" </code></pre> <p>if this line exists, it will go into my action, if not, it will go to the error asking for input result. What is the line meaning? </p> <p>and didn't get into the action class yet. I know the reason is that it violate some default validation interceptor and throw this exception, but I can't find anything wrong with this request with correct param. If I enter correct param firstly, it can get queryResult and goes to Success result without problem. The only different is timing. </p> <p>Do I have to add input result in the configuration xml? I met some project before, and they only has success and error result, no input result at all, why it doesn't works? Something is wrong with my struts.xml?</p> <p>And I don't want to create my own interceptor by disabling struts default validation interceptor</p> <p>I just found a way to walk around it. just delete error result in configuration file, only keep success result, and remove AccionErrors in method searchAction, so user wont' get any warning message for their query request, just show nothing on the page, but this way is secondary option. I still want to show up the error message by solving this problem. </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