struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Letícia Álvares Barbalho <leticia.barba...@gmail.com>
Subject Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map
Date Mon, 22 Aug 2005 17:43:39 GMT
Hey guys, how's everything?

I'm trying to call a LookupDispatchAction from a link, and I'm getting
the error above. I'd like you to help me find the reason...

my jsp is like this:

<font size=2><pre>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%@ page import="auge.conexao.ColecaoService" %>
<%@ page import="java.util.*" %>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html:html locale="true">
<head>
   <title>Coleção</title>
   <html:base/>
   
</head>
<body bgcolor="white">

    <span style="font-family:Sans-serif;">
    
    <table width="100%" align="center">
    <tr><td> Coleção </td></tr>
    <tr bgcolor="#000000"> <td></td></tr>
    </table>

   <br><br><br><br>
   <html:errors/>
   <br>
   
   <html:form action="/UpdateDeleteColecao.do" method="post" focus="colecao">  
     <table border="0" align="center">
         <tr><td width="50%"> Coleção </td><td width="50%"><html:text
property="colecao" value="${requestScope.col.colecao}"
readonly="true"/></td></tr>
         <tr><td width="50%"> Descricão </td><td
width="50%"><html:text property="descricao"
value="${requestScope.col.descricao}"/></td></tr>
         <tr>
            <td width="50%" align="center">
              <html:link action="/UpdateDeleteColecao.do">
<bean:message key="button.add"/> </html:link>
            </td>
            <td width="50%" align="center">
              <html:submit property="method"><bean:message
key="button.delete"/></html:submit>
            </td>
         </tr>      
      </table><br/>
   </html:form> 

   </span> 
</html:html>
</pre></font>

My action is like:
<font size=2><pre>
package auge.action;

import java.util.Map;
import java.util.HashMap;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletException;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.LookupDispatchAction;

import org.hibernate.HibernateException;
import auge.conexao.ColecaoService;
import auge.bean.Colecao;
import auge.form.AddColecaoForm;


public class UpdateDeleteColecaoAction extends LookupDispatchAction {

  protected Map getKeyMethodMap() {
      Map map = new HashMap();
      map.put("button.add", "update");
      map.put("button.delete", "delete");
      return map;
  }
  
  public ActionForward update(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)
          throws IOException, ServletException {
      try {
          AddColecaoForm addColecaoForm = (AddColecaoForm) form;
          Colecao colecao;
          
          try {
              Long colec = Long.valueOf(request.getParameter("colecao"));
              colecao = ColecaoService.getInstance().getColecao(colec);
          } catch (Exception e){
              colecao = new Colecao();
          }
          
          if (addColecaoForm.getDescricao() != null) {
              colecao.setDescricao(addColecaoForm.getDescricao());
              colecao.setColecao(addColecaoForm.getColecao());
              ColecaoService.getInstance().updateColecao(colecao);
              addColecaoForm.clear();
              return mapping.findForward("success");
          }
      } catch(Exception e){
          return mapping.findForward("error");
      }
      return mapping.findForward("error");
  }
  
  public ActionForward delete(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)
          throws IOException, ServletException {
      try {
          AddColecaoForm addColecaoForm = (AddColecaoForm) form;
          
          Long colec = Long.valueOf(request.getParameter("colecao"));
          Colecao colecao = ColecaoService.getInstance().getColecao(colec);
          
          try {
              ColecaoService.getInstance().delColecao(colecao);
          } catch(HibernateException e){
              // nada a fazer
          }
          addColecaoForm.clear();
      } catch(Exception e){
          return mapping.findForward("error");
      } finally{
          return mapping.findForward("success");
      }
  }
  
}
</pre></font>

and my struts-config:

<font size=2><pre>
        <action path="/UpdateDeleteColecao"
                type="auge.action.UpdateDeleteColecaoAction"
                name="addColecaoForm"
                scope="request"
                input="/colecao.jsp"
                parameter="method">        
                <forward name="success" 
path="/pages/confirmacao.jsp"/>
                <forward name="error"  path="/pages/erro.jsp"/>
        </action>
</pre></font>

does anyone know why I'm getting this error? I'd appreciate any help. Thanks.



-- 
Letícia Álvares Barbalho
leticia.barbalho@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message