>
> 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 <strong>DispatchAction</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 <code>ActionForward</code> instance describing where and how
  * control should be forwarded, or <code>null</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">
 <title><bean: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="#ffffff">

<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 %> -->
  <!-- <%= pagerMaxItems %> -->

 <table width="500">
 <TBODY>
  <!-- the page heading... -->
  <tr><td colspan="5" height="10" align="left"
class="pageHeading"><bean:message key="finish.heading"/></td></tr>
  <tr><td colspan="5">&nbsp;</td></tr>

  <!-- the column headings -->
  <tr>
   <td width="25">&nbsp;</td>
   <td width="150" class="columnHeading"><bean:message
key="finish.column.short"/></td>
   <td width="225" class="columnHeading"><bean:message
key="finish.column.long"/></td>
   <td width="50"  class="columnHeading"><bean:message
key="finish.column.reque"/></td>
   <td width="50"  class="columnHeading" align="center"><bean:message
key="finish.column.order"/></td>
  </tr>

  <!-- iterate through the contents of the bean -->
     <logic:iterate id="reason" name="finishReason" scope="session"
type="dhs.vcm.vis.form.finishReason.FinishReasonForm">
      <!-- <%= reason %> -->
       <pg:item>
   <dhshtml:row oddColor="#cddbeb" evenColor="#ffffff" evenStyleClass="text"
oddStyleClass="text">
    <logic:equal name="reason" property="protIndicator" value="N">
     <td>
      <div class="coolBar" style="width:16px">
       <span class="coolButton" style="width:16px">
        <html:link page="/do/FinishReason/Dispatcher" name="reason"
property="deleteParms">
         <html:img page="/images/java/general/Delete16.gif"
             width="16" height="16" alt="Delete" border="0"/>
        </html:link>
       </span>
      </div>
     </td>
    </logic:equal>
    <logic:equal name="reason" property="protIndicator" value=" ">
     <td>
      <div class="coolBar" style="width:16px">
       <span class="coolButton" style="width:16px">
        <html:link page="/do/FinishReason/Dispatcher" name="reason"
property="deleteParms">
         <html:img page="/images/java/general/Delete16.gif"
             width="16" height="16" alt="Delete" border="0"/>
        </html:link>
       </span>
      </div>
     </td>
    </logic:equal>
    <logic:equal name="reason" property="protIndicator" value="Y">
     <td bgcolor="#ffffff" height="16">&nbsp;</td>
    </logic:equal>
    <td>
     <html:link page="/do/FinishReason/Dispatcher" name="reason"
property="updateParms">
      <bean:write name="reason" property="shortDescription"/>
     </html:link>
    </td>
    <td><bean:write name="reason" property="longDescription"/></td>
    <td align="center"><bean:write name="reason"
property="requeIndicator"/></td>
    <td align="center"><bean:write name="reason"
property="orderValue"/></td>
   </dhshtml:row>
    </pg:item>
  </logic:iterate>
 </TBODY>
 </table>

 <!-- the pager row -->
 <table width="500" align="center">
 <tbody>
  <tr><td>&nbsp;</td></tr>
  <tr>
   <td width="15">&nbsp;</td>
   <td class="pagerTag">
    <pg:index>
     Result Pages:&nbsp;
     <pg:prev>
      <!-- <%= pageNumber %> -->
      <a href="<%=pageUrl%>">[&lt;&lt;Prev]</a></pg:prev>
     <pg:pages><%
      if (pageNumber.intValue() < 10) {
       %>&nbsp;<%
      }
      if (pageNumber == pagerPageNumber) {
       %><b><%= pageNumber %></b><%
      } else {
       %><a href="<%=pageUrl%>"><%= pageNumber %></a><%
      }
     %>
     </pg:pages>
     <pg:next>
      <!-- <%= pageNumber %> -->
      &nbsp;<a href="<%=pageUrl%>">[Next&gt;&gt;]</a></pg:next>
     <br>
    </pg:index>
   </td>
  </tr>
  <tr><td colspan="2">&nbsp;</td></tr>
 </tbody>
 </table>
 </pg:pager>
 <br>
 <table>
  <tr>
   <td width="15">&nbsp;</td>
   <td align="left">
    <html:link page="/do/FinishReason/Dispatcher?method=insert">
     <div class="coolBar" style="width:100px">
      <span class="coolButton" style="width:100px">
       <img src="../images/java/general/Add16.gif" width="16" height="16"
alt="" border="0">
       <b><bean:message key="finish.link.insert"/></b>
      </span>
     </div>
    </html:link>
   </td>
  </tr>
 </table>

</html:form>

<html:errors/>

</body>
</html:html>

HTH,


</mark>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to