You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by marc <wd...@wilson.dk> on 2005/05/18 15:34:35 UTC
How do I extend loopupdispatch action?
Ok I have made a class call BaseAction in which I have some customed
code. That extends the Action class. It looks like this:
***********************************************************************
public abstract class BaseAction extends Action{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
IOException, ServletException{
LogedinBean login;
HttpSession session;
if(request.getSession(false)==null){
return mapping.findForward("Login");
}
else session = request.getSession();
if(session.getAttribute("login")==null){
session.invalidate();
return mapping.findForward("Login");
}
else login = (LogedinBean)session.getAttribute("login");
if(login.getLc() == null){
session.invalidate();
return mapping.findForward("Login");
}
return executeAction(mapping, form, request, response);
}
protected abstract ActionForward executeAction(ActionMapping mapping,
ActionForm form,
HttpServletRequest
request,
HttpServletResponse
response) throws IOException, ServletException;
}
******************************************************************************
Now me Q is how do I make this change visible in loopupdispatch action?
Or how do I make a BaseLookupDispatchAction with me custom code?
/Best regards Marc
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How do I extend loopupdispatch action?
Posted by Dakota Jack <da...@gmail.com>.
LookupDispatchAction is a regular elephant as it is so extending that
elephant would be to make a real dinosaur. You might want to look at
www.michaelmcgrady.com/button for some more reasonable approaches.
On 5/18/05, marc <wd...@wilson.dk> wrote:
> Ok I have made a class call BaseAction in which I have some customed
> code. That extends the Action class. It looks like this:
>
> ***********************************************************************
> public abstract class BaseAction extends Action{
>
> public ActionForward execute(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response) throws
> IOException, ServletException{
> LogedinBean login;
> HttpSession session;
>
> if(request.getSession(false)==null){
> return mapping.findForward("Login");
> }
> else session = request.getSession();
>
> if(session.getAttribute("login")==null){
> session.invalidate();
> return mapping.findForward("Login");
> }
> else login = (LogedinBean)session.getAttribute("login");
>
> if(login.getLc() == null){
> session.invalidate();
> return mapping.findForward("Login");
> }
>
> return executeAction(mapping, form, request, response);
> }
>
> protected abstract ActionForward executeAction(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest
> request,
> HttpServletResponse
> response) throws IOException, ServletException;
>
> }
> ******************************************************************************
>
> Now me Q is how do I make this change visible in loopupdispatch action?
> Or how do I make a BaseLookupDispatchAction with me custom code?
>
> /Best regards Marc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org