Let us to take a look how to reference Spring beans in Struts Action
public class SignAction extends Action
{
@Spring(bean = "AuthService") public AuthService authService;
public ActionForward login(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
LoginForm loginForm = (LoginForm) form;
boolean successful = authService.auth(loginForm.getUsername(), loginForm.getPassword());
...
}
In Spring configuration file, AuthService bean declared as following:
<bean id="BasicService" class="net.sf.strutspring.temp.BasicService"/>
If you has already adopt custom RequestProcessor, such as sslext, you can use ActionEjectedSupport, only make Struts action to extend it, just like ActionSupport in Spring. |