Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit a html:form with a link

Status
Not open for further replies.

SuperMoonster

Programmer
Aug 11, 2005
59
BR
Hello everyone,

I want to submit a html:form with a link. It doesn't matter if it's a "a href" or a "html:link", since it works. I know I would need some javascript to do so, but the way I've been doing it so far just doesn't work.

I'm trying to do it this way:

Code:
<%@page contentType="text/html"%>
 <%@page pageEncoding="UTF-8"%>
 <%@ taglib uri="/tags/struts-logic" prefix="logic" %>  
 <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
 <%@ taglib uri="/tags/struts-html" prefix="html" %>
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
 
 <html>
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <title>Coleçôes</title>
                 
         <link rel="stylesheet" type="text/css" href="../config/estilos.css" />
         
         <html:base/>
 
         <script language="JavaScript">
             function dispatchIt()
             {
                 document.forms[0].action="/AddColecao.do";
                 document.forms[0].submit();
             }
         </script>                
 
      </head>
      <body onunload="window.parent.open('blank.jsp','down')">
 
     <span style="font-family:Sans-serif;">
 
     <table width="100%" align="center">
     <tr><td> Coleções </td></tr>
     <tr bgcolor="#000000"> <td></td></tr>
     </table>
 
     <br><br><br>
    <html:form action="/AddColecao.do" method="post" focus="colecao">  
    <table border="0" align="center">
    <tr><td width="50%"> Coleção </td><td width="50%"><html:text property="colecao"/></td></tr>      
    <tr><td width="50%"> Descricão </td><td width="50%"><html:text property="descricao"/></td></tr>
    </table><br/>
 
    <table width="100%">
        <tr>
            <td align="center"><a href="javascript:void(0);" onclick="javascript:dispatchIt();" property="method"> <bean:message key="button.add"/></a></td>
            <td align="center"><a href="teste.htm">Deletar</a></td>
            <td align="center"><a href="teste.htm">Localizar</a></td>
            <td align="center"><a href="teste.htm">Limpar</a></td>
        </tr>
    </table>
 
 
    </html:form> 
    <br><br><br>
    <html:errors/> 
    
    
     </span>
     </body>
 </html>

It doesn't work, giving me the error:

Code:
 HTTP Status 404 - /AddColecao.do
 
 type Status report
 
 message /AddColecao.do
 
 description The requested resource (/AddColecao.do) is not available.
 Apache Tomcat/5.5.

Has anyone ever done it? If so, please tell me how. I've been trying to do it and just haven't got nothing. Sorry to keep asking dumb questions.
 
just needed to put the application name together in the link. /App/Action.do

Works perfectly now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top