I think your tag has a leak of attribute "method"

Your code:
<s:submit key="btn.search" />

will generate HTML likes:

<input type="submit" name="btn.search" value="Search"/>

When you click this button, there will be a http request parameter
like "btn.search=Search".
Struts2 will accept this parameter, and try to save it to your action property.
So, there will be a property setting, which cause method invoking likes:
YourAction.getBtn().setSearch("Search")

But your action does not have a property named "btn",
so getBtn() will get a null, and of cause the setSearch part will fail.


If you add a "method" attribute to submit tag, like:
<s:submit key="btn.search" method="search" />

It will generate HTML like:

<input type="submit" value="Search" name="method:search" />

Notice, the "name" is now "method:search"
So, when you click this button, the http request will be:
"method:search=Search".

Struts will recognize the prefix "method:", so it know that this is a
flag to specify which method to execute, but not a input data which
need to be set in to property of Action.

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

Reply via email to