Hi all,
I'm new to Struts and struggling with Struts2/Javascript.

I have a jsp website with a search form (textfield and submit button). Submitting the button calls the Struts action "SearchAction". "SearchAction" gets the property "searchInput" from the jsp website and does something with it. This works.

But now: I have some (Dojo-)Javascript on my jsp website from which I want to call the request. The Javascript (instead of the submit button) sends a HttpRequest to "SearchAction". I assumed that, like above, "SearchAction" could get the property "searchInput". But this does not work. "SearchAction is called, but the "searchInput" property is null. How would I manage that?

Thanks, Mirko

Search form on the jsp website:
<form id="searchForm" action="none" method="post">
<input type="text" id="searchInput" name="searchInput"></input>
<div dojoType="dijit.form.Button" type="submit">Search</div>
</form>

Request in the Dojo JavaScript:
this._xhr = dojo.xhrPost({
                        url: "./searchAction"
                        load: function(data){
                                // DO THINGS
                        }
              },
              error: function(error){
                  // ERROR
              }
                });


SearchAction class:
public class SearchAction extends ActionSupport  {

        public String execute() throws Exception {
                System.out.println(searchInput); //NULL
                return SUCCESS;
        }

        /* Properties */
        private String searchInput = null;

        public String getSearchInput() {
                return searchInput;
        }

        public void setSearchInput(String value) {
                searchInput = value;
        }



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

Reply via email to