Is anyone successfully using the DispatchAction with html:image tags???
We have this Dispatch Action:
package dhs.vcm.vis.action.finishReason;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import dhs.vcm.vis.business.FinishVisitReasonBO;
import dhs.vcm.vis.db.exception.Fin_Vst_Rsn_Exception;
import dhs.vcm.vis.entity.Constants;
import dhs.vcm.vis.entity.FinishVisitReason;
import dhs.vcm.vis.form.finishReason.FinishReasonDeleteForm;
import dhs.vcm.vis.form.finishReason.FinishReasonUpdateForm;
import dhs.vcm.vis.form.finishReason.FinishVisitReasonFormConverter;
/**
* Implementation of strongDispatchAction/strong that manages the
* insert, update, and delete functionality for the Finish Reason
Maintenance page.
*
* @author Mark H. Nichols
* @version $Revision: 1.0 $ $Date: 2001/02/25 9:08:00 $
*/
public final class DispatcherAction extends DispatchAction {
// - Public Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an codeActionForward/code instance describing where and how
* control should be forwarded, or codenull/code if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param actionForm The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
public ActionForward delete(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// create a new delete form to hold the data for the delete jsp
FinishReasonDeleteForm deleteForm = new FinishReasonDeleteForm() ;
deleteForm.setShortDescription(
(String)request.getParameter(shortDescription) ) ;
request.setAttribute(Constants.FINISH_REASON_DELETE_KEY, deleteForm ) ;
// Forward control to the specified success URI
return (mapping.findForward(delete));
}
public ActionForward insert(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// Forward control to the specified success URI
return (mapping.findForward(insert));
}
public ActionForward update(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// get the row to update using the selected reason Id
FinishReasonUpdateForm updateForm = new FinishReasonUpdateForm() ;
FinishVisitReasonBO reasonBO = new FinishVisitReasonBO() ;
FinishVisitReason reasonForUpdate = new FinishVisitReason() ;
try {
reasonForUpdate =
reasonBO.getByReasonID(Integer.valueOf(request.getParameter(finishReasonID
)).intValue()) ;
}catch (Fin_Vst_Rsn_Exception fvre) {
System.out.println( Finish Visit Reason Exception caught: +
fvre.getMessage()) ;
}
FinishVisitReasonFormConverter.toFinishReasonForm(reasonForUpdate,
updateForm) ;
updateForm.debug() ;
request.setAttribute(Constants.FINISH_REASON_UPDATE_KEY, updateForm ) ;
// Forward control to the specified success URI
return (mapping.findForward(update));
}
}
That works with this JSP using image buttons
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
!-- Some standard includes --
%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
%@ taglib uri=/WEB-INF/dhs-html.tld prefix=dhshtml %
%@ taglib uri=/WEB-INF/pager-taglib.tld prefix=pg %
html:html
head
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
titlebean:message key=finishReasonTest.title//title
html:base/
LINK REL=STYLESHEET TYPE=text/css HREF=../theme/dhs.css
script language=javascript type=text/javascript
src=../js/chromeless_30.js/script
script language=javascript type=text/javascript
src=../js/mainScripts.js/script
script language=javascript type=text/javascript
src=../js/coolbuttons.js/script
/head
body bgcolor=#ff
html:form action=FinishReason/Dispatcher method=post
!-- define a page using the pager tag --
pg:pager maxIndexPages=10 maxPageItems=10
!-- use these variables to keep from getting warnings, but don't render
them
on the resulting page. --
!-- %= pagerPageNumber % --
!-- %= pagerOffset % --
!-- %=