You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mi...@edgil.com on 2004/02/02 16:10:51 UTC

Problems when not using html:form

Hi folks,

For a variety of reasons, I can't use the struts HTML tags in my jsps.  To
get things started, I got it working using html:form, but now I have to
remove that tag.  So, I'm trying to figure out how to specify the form to
correctly call my action.  The jsp gets displayed correctly, but when I
click the submit button, I get an invalid path error.

Here's what my jsp looks like...

   <!-- html:form action="Login" focus="userName" -->
   <form name="LoginForm" method="post" action="Login.do" focus="userName">
      <table border="0" width="100%">
      <!-- input fields removed for brevity... -->
      <tr>
         <td align="right">
            <input type="submit" name="Login" property="Login" value="Log
In" >
         </td>
         <td align="left">
            <input type="submit" name="Reset" property="Reset" value
="Reset" >
         </td>
      </tr>
      </table>
   </form>

And here's the relevant portion of my struts-config file...

  <action-mappings>
    <action path="/Login" type
="com.edgil.TransactionMgr.Actions.LoginAction" name="LoginForm" scope
="request" input="/jsp/Login.jsp">
      <forward name="Main" path="/jsp/Main.jsp" redirect="false"/>
    </action>
  etc...


When I click submit, here's what I get:

Apache Tomcat/4.0.6 - HTTP Status 400 - Invalid path /jsp/Login was
requested
--------------------------------------------------------------------------------
type: Status report
message: Invalid path /jsp/Login was requested
description: The request sent by the client was syntactically incorrect
(Invalid path /jsp/Login was requested).

I suspect that /jsp/... is coming from the fact that the jsp is found in a
directory, called jsp, which is at the same level as WEB_INF.

So, what do I need to specify in the form to trigger the action correctly?

Thanx!

Mike
----
Mike Boucher                  mboucher@edgil.com
Edgil Associates              www.edgil.com

"Don't take life too seriously, you'll never get out of it alive!"


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Problems when not using html:form

Posted by Hubert Rabago <ja...@yahoo.com>.
Wouldn't "/Login.do" make the server look for a "Login.do" resource at the
root of the server?

You need to provide the path to your action relative to how the browser found
your input form.  If your input form is /jsp/Login.jsp and this is what shows
in the URL when requested (meaning, it didn't go through some Action class
before it was shown), you should probably have "../Login.do" in your form's
action attribute.  Or fully qualify it from the server root, something like
action="/myappcontext/Login.do".

hth,
Hubert

--- Joe Germuska <Jo...@Germuska.com> wrote:
> I think that if you just fully-qualify the action of your form, it would
> work.
> 
> That is,
> <form name="LoginForm" method="post" action="/Login.do" focus="userName">
> 
> Joe
> 
> 
> At 10:10 AM -0500 2/2/04, MichaelBoucher@edgil.com wrote:
> >Hi folks,
> >
> >For a variety of reasons, I can't use the struts HTML tags in my jsps.  To
> >get things started, I got it working using html:form, but now I have to
> >remove that tag.  So, I'm trying to figure out how to specify the form to
> >correctly call my action.  The jsp gets displayed correctly, but when I
> >click the submit button, I get an invalid path error.
> >
> >Here's what my jsp looks like...
> >
> >    <!-- html:form action="Login" focus="userName" -->
> >    <form name="LoginForm" method="post" action="Login.do"
> focus="userName">
> >       <table border="0" width="100%">
> >       <!-- input fields removed for brevity... -->
> >       <tr>
> >          <td align="right">
> >             <input type="submit" name="Login" property="Login" value="Log
> >In" >
> >          </td>
> >          <td align="left">
> >             <input type="submit" name="Reset" property="Reset" value
> >="Reset" >
> >          </td>
> >       </tr>
> >       </table>
> >    </form>
> >
> >And here's the relevant portion of my struts-config file...
> >
> >   <action-mappings>
> >     <action path="/Login" type
> >="com.edgil.TransactionMgr.Actions.LoginAction" name="LoginForm" scope
> >="request" input="/jsp/Login.jsp">
> >       <forward name="Main" path="/jsp/Main.jsp" redirect="false"/>
> >     </action>
> >   etc...
> >
> >
> >When I click submit, here's what I get:
> >
> >Apache Tomcat/4.0.6 - HTTP Status 400 - Invalid path /jsp/Login was
> >requested
>
>--------------------------------------------------------------------------------
> >type: Status report
> >message: Invalid path /jsp/Login was requested
> >description: The request sent by the client was syntactically incorrect
> >(Invalid path /jsp/Login was requested).
> >
> >I suspect that /jsp/... is coming from the fact that the jsp is found in a
> >directory, called jsp, which is at the same level as WEB_INF.
> >
> >So, what do I need to specify in the form to trigger the action correctly?
> >
> >Thanx!
> >
> >Mike
> >----
> >Mike Boucher                  mboucher@edgil.com
> >Edgil Associates              www.edgil.com
> >
> >"Don't take life too seriously, you'll never get out of it alive!"
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> -- 
> Joe Germuska            
> Joe@Germuska.com  
> http://blog.germuska.com    
>        "Imagine if every Thursday your shoes exploded if you tied them 
> the usual way.  This happens to us all the time with computers, and 
> nobody thinks of complaining."
>              -- Jef Raskin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Problems when not using html:form

Posted by Joe Germuska <Jo...@Germuska.com>.
I think that if you just fully-qualify the action of your form, it would work.

That is,
<form name="LoginForm" method="post" action="/Login.do" focus="userName">

Joe


At 10:10 AM -0500 2/2/04, MichaelBoucher@edgil.com wrote:
>Hi folks,
>
>For a variety of reasons, I can't use the struts HTML tags in my jsps.  To
>get things started, I got it working using html:form, but now I have to
>remove that tag.  So, I'm trying to figure out how to specify the form to
>correctly call my action.  The jsp gets displayed correctly, but when I
>click the submit button, I get an invalid path error.
>
>Here's what my jsp looks like...
>
>    <!-- html:form action="Login" focus="userName" -->
>    <form name="LoginForm" method="post" action="Login.do" focus="userName">
>       <table border="0" width="100%">
>       <!-- input fields removed for brevity... -->
>       <tr>
>          <td align="right">
>             <input type="submit" name="Login" property="Login" value="Log
>In" >
>          </td>
>          <td align="left">
>             <input type="submit" name="Reset" property="Reset" value
>="Reset" >
>          </td>
>       </tr>
>       </table>
>    </form>
>
>And here's the relevant portion of my struts-config file...
>
>   <action-mappings>
>     <action path="/Login" type
>="com.edgil.TransactionMgr.Actions.LoginAction" name="LoginForm" scope
>="request" input="/jsp/Login.jsp">
>       <forward name="Main" path="/jsp/Main.jsp" redirect="false"/>
>     </action>
>   etc...
>
>
>When I click submit, here's what I get:
>
>Apache Tomcat/4.0.6 - HTTP Status 400 - Invalid path /jsp/Login was
>requested
>--------------------------------------------------------------------------------
>type: Status report
>message: Invalid path /jsp/Login was requested
>description: The request sent by the client was syntactically incorrect
>(Invalid path /jsp/Login was requested).
>
>I suspect that /jsp/... is coming from the fact that the jsp is found in a
>directory, called jsp, which is at the same level as WEB_INF.
>
>So, what do I need to specify in the form to trigger the action correctly?
>
>Thanx!
>
>Mike
>----
>Mike Boucher                  mboucher@edgil.com
>Edgil Associates              www.edgil.com
>
>"Don't take life too seriously, you'll never get out of it alive!"
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org