My guess is the problem lies outside your Action code, since you
specify "acao=editar" in your request, "acao" is the parameter for
your DispatchAction, and you have an "editar" method. Are you able to
call normal Struts actions okay?
Yes, I am able, for example, to save data from the form, as follow:
public ActionForward salvar(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors erros = new ActionErrors();
ActionForward forward = null;
ClienteDAO cadastroDAO = new ClienteDAO(this.getConnection());
ClienteFormBean clienteForm = (ClienteFormBean) form;
try {
cadastroDAO.insert(clienteForm);
forward = mapping.findForward("sucesso");
request.setAttribute("resultado",
"O Cliente foi salvo com sucesso.");
} catch (SQLException e) {
e.printStackTrace();
erros.add(ActionErrors.GLOBAL_ERROR,
new ActionError("errors.persistirCadastro",
new String[] { e.getMessage() }));
forward = mapping.findForward("falha");
} catch (Exception e) {
e.printStackTrace();
erros.add(ActionErrors.GLOBAL_ERROR,
new ActionError("errors.persistirCadastro",
new String[] { e.getMessage() }));
forward = mapping.findForward("falha");
}
if (!erros.isEmpty()) {
saveErrors(request, erros);
}
request.getSession().invalidate();
return forward;
}
<html:hidden property="acao" value="error" />
<html:submit styleClass="caixaPontilhada" onclick="setMetodo('salvar');"
style="width:150px;">
<bean:message key="botao.enviar" />
</html:submit>
Could you point me what are the steps to perform this I am trying?? Then
I will check everything here.
Thanks
Francisco
Hubert Rabago escreveu:
On 9/27/05, Francisco - São Paulo - Brazil <[EMAIL PROTECTED]> wrote:
When I tryed this way:
href="CadastroClienteDispatchAction.do..."
HTTP Status 400 - Invalid path /pages/CadastroClienteDispatchAction was
requested
This is because your JSP and your actions are in different paths.
When I tryed this way it worked:
href="/ExemploStruts/CadastroClienteDispatchAction.do..."
But it did not populate my form with the values in the bean
Did you include the parameters you wanted to populate?
<a
href="/ExemploStruts//CadastroClienteDispatchAction.do?acao=editar&codigo=<bean:write
name='lista' property='codigo'/>">
and it seems
to invoke an submit imediately after loading.
Isn't this a link? So when you click it, it will immediately load the
resource referenced by the link. I'm not sure I understand your
concern.
As it didnt populate the form with data and some fields are
validated/required the errors messages are shown.
This is the expected behavior when there's a validation error. Once
the issue about why you're having validation problems are solved, you
shouldn't see this problem anymore.
Maybe something in here, could you have a look please?
My guess is the problem lies outside your Action code, since you
specify "acao=editar" in your request, "acao" is the parameter for
your DispatchAction, and you have an "editar" method. Are you able to
call normal Struts actions okay?
Hubert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_______________________________________________________
Novo Yahoo! Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e muito mais. Instale agora!
www.yahoo.com.br/messenger/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]