I personnaly prefer to use the same Action for things that are logically grouped. So in your case, I would use the execute method to return SUCCESS, pointing to the jsp, and a doSearch method with SEARCH result, pointing to the other JSP. That way, you have only one action for both JSP.

I don't like going straight to the JSP, as you lose all of the struts 2 benefits, and so I prefer everybody to go through their action, even if that sometimes means having a execute method that just return SUCCESS.

We are using so many struts default functionnalities that only work with the underlying actions (like resource bundles, etc..) that I really couldn't live without an action.

Denis.

Le 2010-05-21 07:59, Fabio Perfetti a écrit :
Hi all,
i am wondering what is the best way for link a page to other.
Imagine this scenario:

Index Page with a menu:
- Search
- Insert

if i click on search, must show a form.
so I use
<a href="<s:url action='searchForm' />">Search</a>

in my struts.xml i have an action
<action name="searchForm">
   <result>formSearch.jsp</result>
</action>

now i fill the form and on submit, i call the action doSearch

<action name="doSearch" class="it.tesina.action.Search">
   <result>listSearch.jsp</result>
</action>

So i have 2 actions. one for show the form and one for the true search.
and the same for the Insert.

is it correct? is there any other method more efficient?

Thanks all
Fabio



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

Reply via email to