Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map

2005-08-22 Thread Michael Jouravlev
Seems to me that you do not really understand what
LookupDispatchAction is for and how does it work. Do you have property
file that maps button caption to "button.add" property name? Well,
even if you do, you do not have to use LookupDispatchAction, because
you use a link.

Use standard DispathAction instead. Or use something else, like
SelectAction, which works uniformly with pushbuttons, links and
imagebuttons:
http://struts.sourceforge.net/strutsdialogs/selectaction.html

---
Struts Dialogs:
http://struts.sourceforge.net/strutsdialogs


On 8/22/05, Letícia Álvares Barbalho <[EMAIL PROTECTED]> wrote:
> Well, I should be embarrassed by now. Actually, you're 100% correct:
> something is sending literally 'button.delete' as the value of method param,
> instead of the value from the .properties file. And this something would be
> me.
> 
> It happens that I am not using html:submit buttons to call the dispatch
> action. Instead of it, I'm trying to use links, like this:
> 
>  property="method"> 
> 
> Well, if it worked like the html:button, it would send the method with the
> value from the bean. But it obviously doesn't. So, I put this js function to
> be called onclick:
> 
> function dispatchIt()
> {
> document.addColecaoForm.action="/AugeProducao/UpdateDeleteColecao.do?method=
> button.add";
> document.addColecaoForm.submit();
> }
> 
> 
> And that's causing the error. So, if the property=method doesn't work, and
> passing it literally doesn't work... that means I cannot use links to submit
> the form? Or am I doing it totally wrong?
> 
> Sorry, thanks.

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



Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map

2005-08-22 Thread Letícia Álvares Barbalho
Wendy, thank you a lot for the help
I ended up solving the problem using smart forwarding... it seemed a little 
better (and I must say, it worked faster hehe)
anyways, I'll try the solution you gave so I'll know it the next time

thank you

On 8/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> 
> >  > property="method"> 
> >
> > Well, if it worked like the html:button, it would send the method with 
> the
> > value from the bean. But it obviously doesn't. So, I put this js 
> function
> > to
> > be called onclick:
> >
> > function dispatchIt()
> > {
> > document.addColecaoForm.action=
> "/AugeProducao/UpdateDeleteColecao.do?method=
> > button.add";
> > document.addColecaoForm.submit();
> > }
> >
> > And that's causing the error. So, if the property=method doesn't work, 
> and
> > passing it literally doesn't work... that means I cannot use links to
> > submit
> > the form? Or am I doing it totally wrong?
> 
> You're on the right track... but I admit to just hardcoding the text value
> for the
> button. :)
> 
> Change it to method=Add (or whatever the value is from
> ApplicationResources.properties) and it should start working. From there,
> you can figure out how to retrieve the value for the right locale. Without
> actually trying it, I think possibly  and  (JSTL) and
> then use an expression inside the script.
> 
> --
> Wendy Smoak
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Letícia Álvares Barbalho
[EMAIL PROTECTED]


Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map

2005-08-22 Thread Wendy Smoak

 

Well, if it worked like the html:button, it would send the method with the
value from the bean. But it obviously doesn't. So, I put this js function 
to

be called onclick:

function dispatchIt()
{
document.addColecaoForm.action="/AugeProducao/UpdateDeleteColecao.do?method=
button.add";
document.addColecaoForm.submit();
}

And that's causing the error. So, if the property=method doesn't work, and
passing it literally doesn't work... that means I cannot use links to 
submit

the form? Or am I doing it totally wrong?


You're on the right track... but I admit to just hardcoding the text value 
for the

button. :)

Change it to method=Add (or whatever the value is from 
ApplicationResources.properties) and it should start working.  From there, 
you can figure out how to retrieve the value for the right locale.  Without 
actually trying it, I think possibly  and  (JSTL) and 
then use an expression inside the script.


--
Wendy Smoak 




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



Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map

2005-08-22 Thread Letícia Álvares Barbalho
Well, I should be embarrassed by now. Actually, you're 100% correct: 
something is sending literally 'button.delete' as the value of method param, 
instead of the value from the .properties file. And this something would be 
me.

It happens that I am not using html:submit buttons to call the dispatch 
action. Instead of it, I'm trying to use links, like this:

 

Well, if it worked like the html:button, it would send the method with the 
value from the bean. But it obviously doesn't. So, I put this js function to 
be called onclick:

function dispatchIt()
{
document.addColecaoForm.action="/AugeProducao/UpdateDeleteColecao.do?method=
button.add";
document.addColecaoForm.submit();
}


And that's causing the error. So, if the property=method doesn't work, and 
passing it literally doesn't work... that means I cannot use links to submit 
the form? Or am I doing it totally wrong?

Sorry, thanks.


On 8/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> 
> > 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...
> 
> It looks like something is sending (literally) 'button.delete' as the 
> value
> of the 'method' param, instead of using value from
> ApplicationResources.properties.
> 
> What HTML does this turn into?
> 
> > 
> > 
> > 
> 
> Assuming your properties file is in place and properly configured, that
> should work.
> 
> --
> Wendy Smoak
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Letícia Álvares Barbalho
[EMAIL PROTECTED]


Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map

2005-08-22 Thread Wendy Smoak

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...


It looks like something is sending (literally) 'button.delete' as the value 
of the 'method' param, instead of using value from 
ApplicationResources.properties.


What HTML does this turn into?







Assuming your properties file is in place and properly configured, that 
should work.


--
Wendy Smoak



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



Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map

2005-08-22 Thread Letícia Álvares Barbalho
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:


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

http://www.w3.org/TR/html4/loose.dtd";>



   Coleção
   
   






 Coleção 
 


   
   
   
   
 
 
  Coleção 
  Descricão 
 

  
 


  

   
  






My action is like:

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");
  }
  }
  
}


and my struts-config:








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



-- 
Letícia Álvares Barbalho
[EMAIL PROTECTED]