You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Curtney Jacobs <c....@comcast.net> on 2003/07/25 20:47:40 UTC
Form action url get rewritten.
Greetings!!
I am getting this strange behavior in my forms. Within my jsp form I have my
action written as the following:
action="/student/update.do"
However, when the form is displayed via the browser, and a doing a view
source, I see the following:
action="/sesm/student/update.do"
It seems that my web application root directory gets tacked onto the logical
url.
Can someone explain to me why this is happening.
Thanks,
Curtney
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Form action url get rewritten.
Posted by Mark Lowe <ma...@talk21.com>.
On Friday, July 25, 2003, at 08:08 PM, Curtney Jacobs wrote:
> Oopse,
>
> I forge to add that my action is no longer being called. It was
> working fine
> two days ago. I don't know what broke it. The only thing I notice was
> what I
> have written below. Also, I have pasted the relevant parts of my
> struts-config.xml file. The funny thing is that all of my other
> actions works
> fine. I have just notice that the logical url of the other actions for
> my
> forms are also being re-written, attaching the application root, but
> seems to
> work OK.
>
> Help Please.
>
> _CJ
>
> <form-bean name="StudentForm"
> type="com.jacobs.sesm.struts.form.StudentForm"
> />
>
> <action
> path="/student/update"
> type="com.jacobs.sesm.struts.action.UpdateStudentAction"
> name="StudentForm"
> scope="session"
> input="/struts/jspform/StudentForm.jsp"
> parameter="id" >
The parameter attribute is used my Actions that extend DispatchAction
you don't use it unless you are using dispatch action. Many folks call
the pararmeter method or action as its the mechanism for selecting the
relevant method..
<action path="/myaction.do type="com.sparrow.struts.MyAction"
parameter="method">
//in the action class
public final class MyAction extends
org.apache.struts.actions.DispatchAction {
public final ActionForward mymethod(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
//jsp
<html:link page="/myaction.do?method=mymethod"...
There are more elegant ways of passing in the parameter named method
including of course having a form element called thus. I tend to use a
standard form element, so I don't have to declare a form property
called method, as its more a method selection mechanism.
>
> <forward name="success"
> path="/content/page/student.jsp?Student"
> redirect="true" />
>
> </action>
>
>
> On Friday 25 July 2003 11:47 am, Curtney Jacobs wrote:
>> Greetings!!
>>
>> I am getting this strange behavior in my forms. Within my jsp form I
>> have
>> my action written as the following:
>>
>> action="/student/update.do"
I assume that you have to pass an ID through to be able to carryout
operations on a student object.
>>
>> However, when the form is displayed via the browser, and a doing a
>> view
>> source, I see the following:
>>
>> action="/sesm/student/update.do"
If your webapp is called sesm then this is fine..
/webapps/sesm
Is what you directory structure should look like. One of the advantages
of using struts or other tags that support this sort of thing, is you
don't get into the business of writing the whole path e.g.
/sesm/myaction.do
>>
>> It seems that my web application root directory gets tacked onto the
>> logical url.
The documentation on html:link and html:rewrite should clear this all
up, the user guide also as i recall covers all this.,
>>
>> Can someone explain to me why this is happening.
>>
>> Thanks,
>>
>> Curtney
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Form action url get rewritten.
Posted by Curtney Jacobs <c....@comcast.net>.
Oopse,
I forge to add that my action is no longer being called. It was working fine
two days ago. I don't know what broke it. The only thing I notice was what I
have written below. Also, I have pasted the relevant parts of my
struts-config.xml file. The funny thing is that all of my other actions works
fine. I have just notice that the logical url of the other actions for my
forms are also being re-written, attaching the application root, but seems to
work OK.
Help Please.
_CJ
<form-bean name="StudentForm" type="com.jacobs.sesm.struts.form.StudentForm"
/>
<action
path="/student/update"
type="com.jacobs.sesm.struts.action.UpdateStudentAction"
name="StudentForm"
scope="session"
input="/struts/jspform/StudentForm.jsp"
parameter="id" >
<forward name="success" path="/content/page/student.jsp?Student"
redirect="true" />
</action>
On Friday 25 July 2003 11:47 am, Curtney Jacobs wrote:
> Greetings!!
>
> I am getting this strange behavior in my forms. Within my jsp form I have
> my action written as the following:
>
> action="/student/update.do"
>
> However, when the form is displayed via the browser, and a doing a view
> source, I see the following:
>
> action="/sesm/student/update.do"
>
> It seems that my web application root directory gets tacked onto the
> logical url.
>
> Can someone explain to me why this is happening.
>
> Thanks,
>
> Curtney
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org