Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Form results on same page

Status
Not open for further replies.

hauss

Programmer
Jan 31, 2005
1
US
Newbie to struts here.

I'm trying to create a search form that, when submitted, displays the search results on the same page. Right now I am encountering an infinite loop due to my action mapping (included below). What's happening (I stepped through using remote debugging) is that my actionform validate AND my actual action which does the search is being executed even before the page is rendered. I can understand the actionform but why is the action being executed? The action returns to the success mapping which is the same page.. resulting in the infinite loop. Incase it gets asked.. I do have to have them both on the same page.

What is the "best practices" way to tell an action not to execute unless submit is clicked.. query string parameters for example?


-- exceprt from struts-config.xml
<form-bean name="search"
type="forms.searchFormBean"/>

...

<action path="/Search"
type="actions.MySearchAction"
input="/Search.do"
name="search"
scope="request">
<forward name="success" path="/Search.do"/>
</action>

--- search.jsp
<html:form action="Search.do" >
<html:text property="keywords"/><br/>
<html:submit>Search</html:submit><br/>
</html:form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top