You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Erik Weber <er...@mindspring.com> on 2004/07/06 01:01:14 UTC

Form tag problem

Could someone please tell me what would cause the html:form tag to 
ignore the value I specify to the action parameter, and instead, rewrite 
the action parameter value to be equal to the context root of the 
application?


For example, my web app login page is:

http://localhost:8080/Test/index.jsp

In login.jsp, I have this opening form tag:

<html:form action="/login">

I have a matching action configured in struts-config.xml. But the struts 
tag is rendering the form tag like this:

<form name="loginForm" action="/Test">


No matter what I try this does not change. This is extremely 
frustrating. Any help would be appreciated.

Erik


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


Re: Form tag problem

Posted by atta-ur rehman <at...@numetrics.com>.
Okay. this all i have in my web.xml and it works:

<servlet>
     <servlet-name>action</servlet-name>
      
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
     <init-param>
       <param-name>config</param-name>
       <param-value>/WEB-INF/struts-config.xml</param-value>
     </init-param>
     <init-param>
       <param-name>debug</param-name>
       <param-value>2</param-value>
     </init-param>
     <init-param>
       <param-name>detail</param-name>
       <param-value>2</param-value>
     </init-param>
     <load-on-startup>2</load-on-startup>
   </servlet>

   <!-- Standard Action Servlet Mapping -->

   <servlet-mapping>
     <servlet-name>action</servlet-name>
     <url-pattern>*.do</url-pattern>
   </servlet-mapping>


hope this helps.

ATTA

On Jul 5, 2004, at 4:46 PM, Erik Weber wrote:

> I should make one more correction. Actually when I mapped the  
> controller Servlet to "/", the correct action parameter did show up in  
> the form, and things worked correctly. However, I don't want to use  
> "/" as my controller mapping -- I would rather do something more  
> specific. But "/login" and "/login/*" for example don't work.
>
> So again, I guess my question is still the same. Could someone explain  
> how the action attribute relates to the controller Servlet mapping,  
> and how I should use the <servlet-mapping> section to make this work  
> correctly?
>
> Thanks,
> Erik
>
>
>
> Erik Weber wrote:
>
>> <form-beans>
>> <form-bean name="loginForm"  
>> type="org.apache.struts.validator.DynaValidatorForm">
>> <form-property name="username" type="java.lang.String"/>
>> <form-property name="password" type="java.lang.String"/>
>> </form-bean>
>> </form-beans>
>>
>> <action-mappings>
>> <action path="/login" type="LoginAction" name="loginForm"  
>> scope="session" input="/login.jsp">
>> <forward name="success" path="/home.jsp"/>
>> <forward name="failure" path="/login.jsp"/>
>> </action>
>> </action-mappings>
>>
>> <message-resources parameter="ApplicationResources"/>
>>
>>
>> I have tried mapping the controller servlet to all kinds of path  
>> prefixes including "/login" and "/login/*" and "/". None of them  
>> result in the correct action parameter in the form. I don't want to  
>> use extension mapping. I want to use path mapping. Is this where the  
>> problem is?
>>
>>
>>
>> atta-ur rehman wrote:
>>
>>> Hello Erik,
>>>
>>> Is it possible for you to show your struts-config.xml file?
>>>
>>> ATTA
>>>
>>> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>>>
>>>> Could someone please tell me what would cause the html:form tag to  
>>>> ignore the value I specify to the action parameter, and instead,  
>>>> rewrite the action parameter value to be equal to the context root  
>>>> of the application?
>>>>
>>>>
>>>> For example, my web app login page is:
>>>>
>>>> http://localhost:8080/Test/index.jsp
>>>>
>>>> In login.jsp, I have this opening form tag:
>>>>
>>>> <html:form action="/login">
>>>>
>>>> I have a matching action configured in struts-config.xml. But the  
>>>> struts tag is rendering the form tag like this:
>>>>
>>>> <form name="loginForm" action="/Test">
>>>>
>>>>
>>>> No matter what I try this does not change. This is extremely  
>>>> frustrating. Any help would be appreciated.
>>>>
>>>> Erik
>>>>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: Form tag problem

Posted by Erik Weber <er...@mindspring.com>.
I should make one more correction. Actually when I mapped the controller 
Servlet to "/", the correct action parameter did show up in the form, 
and things worked correctly. However, I don't want to use "/" as my 
controller mapping -- I would rather do something more specific. But 
"/login" and "/login/*" for example don't work.

So again, I guess my question is still the same. Could someone explain 
how the action attribute relates to the controller Servlet mapping, and 
how I should use the <servlet-mapping> section to make this work correctly?

Thanks,
Erik



Erik Weber wrote:

> <form-beans>
> <form-bean name="loginForm" 
> type="org.apache.struts.validator.DynaValidatorForm">
> <form-property name="username" type="java.lang.String"/>
> <form-property name="password" type="java.lang.String"/>
> </form-bean>
> </form-beans>
>
> <action-mappings>
> <action path="/login" type="LoginAction" name="loginForm" 
> scope="session" input="/login.jsp">
> <forward name="success" path="/home.jsp"/>
> <forward name="failure" path="/login.jsp"/>
> </action>
> </action-mappings>
>
> <message-resources parameter="ApplicationResources"/>
>
>
> I have tried mapping the controller servlet to all kinds of path 
> prefixes including "/login" and "/login/*" and "/". None of them 
> result in the correct action parameter in the form. I don't want to 
> use extension mapping. I want to use path mapping. Is this where the 
> problem is?
>
>
>
> atta-ur rehman wrote:
>
>> Hello Erik,
>>
>> Is it possible for you to show your struts-config.xml file?
>>
>> ATTA
>>
>> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>>
>>> Could someone please tell me what would cause the html:form tag to 
>>> ignore the value I specify to the action parameter, and instead, 
>>> rewrite the action parameter value to be equal to the context root 
>>> of the application?
>>>
>>>
>>> For example, my web app login page is:
>>>
>>> http://localhost:8080/Test/index.jsp
>>>
>>> In login.jsp, I have this opening form tag:
>>>
>>> <html:form action="/login">
>>>
>>> I have a matching action configured in struts-config.xml. But the 
>>> struts tag is rendering the form tag like this:
>>>
>>> <form name="loginForm" action="/Test">
>>>
>>>
>>> No matter what I try this does not change. This is extremely 
>>> frustrating. Any help would be appreciated.
>>>
>>> Erik
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Form tag problem

Posted by Erik Weber <er...@mindspring.com>.
Well I have found the answer to the relative URI problem with the 
html:img, html:rewrite and html:link tags. Now those are quite useful! 
Unfortunately, the O'Reilly Struts book was of no help to me with any of 
these matters. If any newbie reads this and wants to get up to speed 
quickly, I found this site to be helpful:

http://www.reumann.net/do/struts/main

I may not have ever noticed the html:rewrite tag without it.

Thanks again for your help.

Erik



Erik Weber wrote:

> I finally figured it out, thanks to your help.
>
> I was trying to match what the controller servlet was mapped to in my 
> action parameter to the html:form tag, when in reality, I should have 
> been doing the opposite. The html:form tag apparently prefixes the 
> controller path token to whatever action you specify.
>
> So if you use this in web.xml:
>
> <url-pattern>/do/*</url-pattern>
>
> Then you name your action something like "/login". Then you specify 
> action="/login" as the html:form tag attribute. When the page gets 
> rendered, the form tag shows this:
>
> <form action="Test/do/login">
>
> which is correct.
>
> The docs need some help on this subject! I was, in ignorance, trying 
> to make sure "/do" was in the path of my action, when in reality, it 
> needed to be generated, not placed by me. That was the problem.
>
> Thanks again for your help.
>
> Now of course the new problem is that relative image URIs don't work 
> when a forward has occurred and the request URI is inconsistent with 
> what the page expects . . . Any advice on this challenge would again 
> be appreciated.
>
> Erik
>
>
>
> atta-ur rehman wrote:
>
>> okay, before i leave for the day, for path based mapping, you need 
>> something like:
>>
>> <servlet-mapping>
>> <servlet-name>controller</servlet-name>
>> <url-pattern>/do/</url-pattern>
>> </servlet-mapping>
>>
>> then all your urls must be like:
>>
>> localhost/app/do/login
>>
>> that's how i understand it. you may wanna have look at struts docos 
>> for this parameter.
>>
>> ATTA
>>
>>
>> On Jul 5, 2004, at 4:57 PM, Erik Weber wrote:
>>
>>> Thanks for helping.
>>>
>>> I assume you mean this part:
>>>
>>> <servlet-mapping>
>>> <servlet-name>controller</servlet-name>
>>> <url-pattern>/</url-pattern>
>>> </servlet-mapping>
>>>
>>> The above code works (hooray), but if I try to change the url 
>>> pattern to anything more specific (such as /login, or /login*, or 
>>> /login/*) I get the wrong action parameter value . . .
>>>
>>>
>>>
>>> atta-ur rehman wrote:
>>>
>>>> Okay, now you need to show your web.xml!
>>>>
>>>> struts-config.xml looks fine. I'd suggest you try it with .do 
>>>> extension first and then try path mapping in web.xml
>>>>
>>>> ATTA
>>>>
>>>> On Jul 5, 2004, at 4:40 PM, Erik Weber wrote:
>>>>
>>>>> <form-beans>
>>>>> <form-bean name="loginForm" 
>>>>> type="org.apache.struts.validator.DynaValidatorForm">
>>>>> <form-property name="username" type="java.lang.String"/>
>>>>> <form-property name="password" type="java.lang.String"/>
>>>>> </form-bean>
>>>>> </form-beans>
>>>>>
>>>>> <action-mappings>
>>>>> <action path="/login" type="LoginAction" name="loginForm" 
>>>>> scope="session" input="/login.jsp">
>>>>> <forward name="success" path="/home.jsp"/>
>>>>> <forward name="failure" path="/login.jsp"/>
>>>>> </action>
>>>>> </action-mappings>
>>>>>
>>>>> <message-resources parameter="ApplicationResources"/>
>>>>>
>>>>>
>>>>> I have tried mapping the controller servlet to all kinds of path 
>>>>> prefixes including "/login" and "/login/*" and "/". None of them 
>>>>> result in the correct action parameter in the form. I don't want 
>>>>> to use extension mapping. I want to use path mapping. Is this 
>>>>> where the problem is?
>>>>>
>>>>>
>>>>>
>>>>> atta-ur rehman wrote:
>>>>>
>>>>>> Hello Erik,
>>>>>>
>>>>>> Is it possible for you to show your struts-config.xml file?
>>>>>>
>>>>>> ATTA
>>>>>>
>>>>>> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>>>>>>
>>>>>>> Could someone please tell me what would cause the html:form tag 
>>>>>>> to ignore the value I specify to the action parameter, and 
>>>>>>> instead, rewrite the action parameter value to be equal to the 
>>>>>>> context root of the application?
>>>>>>>
>>>>>>>
>>>>>>> For example, my web app login page is:
>>>>>>>
>>>>>>> http://localhost:8080/Test/index.jsp
>>>>>>>
>>>>>>> In login.jsp, I have this opening form tag:
>>>>>>>
>>>>>>> <html:form action="/login">
>>>>>>>
>>>>>>> I have a matching action configured in struts-config.xml. But 
>>>>>>> the struts tag is rendering the form tag like this:
>>>>>>>
>>>>>>> <form name="loginForm" action="/Test">
>>>>>>>
>>>>>>>
>>>>>>> No matter what I try this does not change. This is extremely 
>>>>>>> frustrating. Any help would be appreciated.
>>>>>>>
>>>>>>> Erik
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------- 
>>>>>>> -- 
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> -------------------------------------------------------------------- 
>>>>>> -
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Form tag problem

Posted by Erik Weber <er...@mindspring.com>.
I finally figured it out, thanks to your help.

I was trying to match what the controller servlet was mapped to in my 
action parameter to the html:form tag, when in reality, I should have 
been doing the opposite. The html:form tag apparently prefixes the 
controller path token to whatever action you specify.

So if you use this in web.xml:

<url-pattern>/do/*</url-pattern>

Then you name your action something like "/login". Then you specify 
action="/login" as the html:form tag attribute. When the page gets 
rendered, the form tag shows this:

<form action="Test/do/login">

which is correct.

The docs need some help on this subject! I was, in ignorance, trying to 
make sure "/do" was in the path of my action, when in reality, it needed 
to be generated, not placed by me. That was the problem.

Thanks again for your help.

Now of course the new problem is that relative image URIs don't work 
when a forward has occurred and the request URI is inconsistent with 
what the page expects . . . Any advice on this challenge would again be 
appreciated.

Erik



atta-ur rehman wrote:

> okay, before i leave for the day, for path based mapping, you need 
> something like:
>
> <servlet-mapping>
> <servlet-name>controller</servlet-name>
> <url-pattern>/do/</url-pattern>
> </servlet-mapping>
>
> then all your urls must be like:
>
> localhost/app/do/login
>
> that's how i understand it. you may wanna have look at struts docos 
> for this parameter.
>
> ATTA
>
>
> On Jul 5, 2004, at 4:57 PM, Erik Weber wrote:
>
>> Thanks for helping.
>>
>> I assume you mean this part:
>>
>> <servlet-mapping>
>> <servlet-name>controller</servlet-name>
>> <url-pattern>/</url-pattern>
>> </servlet-mapping>
>>
>> The above code works (hooray), but if I try to change the url pattern 
>> to anything more specific (such as /login, or /login*, or /login/*) I 
>> get the wrong action parameter value . . .
>>
>>
>>
>> atta-ur rehman wrote:
>>
>>> Okay, now you need to show your web.xml!
>>>
>>> struts-config.xml looks fine. I'd suggest you try it with .do 
>>> extension first and then try path mapping in web.xml
>>>
>>> ATTA
>>>
>>> On Jul 5, 2004, at 4:40 PM, Erik Weber wrote:
>>>
>>>> <form-beans>
>>>> <form-bean name="loginForm" 
>>>> type="org.apache.struts.validator.DynaValidatorForm">
>>>> <form-property name="username" type="java.lang.String"/>
>>>> <form-property name="password" type="java.lang.String"/>
>>>> </form-bean>
>>>> </form-beans>
>>>>
>>>> <action-mappings>
>>>> <action path="/login" type="LoginAction" name="loginForm" 
>>>> scope="session" input="/login.jsp">
>>>> <forward name="success" path="/home.jsp"/>
>>>> <forward name="failure" path="/login.jsp"/>
>>>> </action>
>>>> </action-mappings>
>>>>
>>>> <message-resources parameter="ApplicationResources"/>
>>>>
>>>>
>>>> I have tried mapping the controller servlet to all kinds of path 
>>>> prefixes including "/login" and "/login/*" and "/". None of them 
>>>> result in the correct action parameter in the form. I don't want to 
>>>> use extension mapping. I want to use path mapping. Is this where 
>>>> the problem is?
>>>>
>>>>
>>>>
>>>> atta-ur rehman wrote:
>>>>
>>>>> Hello Erik,
>>>>>
>>>>> Is it possible for you to show your struts-config.xml file?
>>>>>
>>>>> ATTA
>>>>>
>>>>> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>>>>>
>>>>>> Could someone please tell me what would cause the html:form tag 
>>>>>> to ignore the value I specify to the action parameter, and 
>>>>>> instead, rewrite the action parameter value to be equal to the 
>>>>>> context root of the application?
>>>>>>
>>>>>>
>>>>>> For example, my web app login page is:
>>>>>>
>>>>>> http://localhost:8080/Test/index.jsp
>>>>>>
>>>>>> In login.jsp, I have this opening form tag:
>>>>>>
>>>>>> <html:form action="/login">
>>>>>>
>>>>>> I have a matching action configured in struts-config.xml. But the 
>>>>>> struts tag is rendering the form tag like this:
>>>>>>
>>>>>> <form name="loginForm" action="/Test">
>>>>>>
>>>>>>
>>>>>> No matter what I try this does not change. This is extremely 
>>>>>> frustrating. Any help would be appreciated.
>>>>>>
>>>>>> Erik
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------- 
>>>>>> -- 
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> -------------------------------------------------------------------- 
>>>>> -
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Form tag problem

Posted by atta-ur rehman <at...@numetrics.com>.
okay, before i leave for the day, for path based mapping, you need  
something like:

<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/do/</url-pattern>
</servlet-mapping>

then all your urls must be like:

localhost/app/do/login

that's how i understand it. you may wanna have look at struts docos for  
this parameter.

ATTA


On Jul 5, 2004, at 4:57 PM, Erik Weber wrote:

> Thanks for helping.
>
> I assume you mean this part:
>
> <servlet-mapping>
> <servlet-name>controller</servlet-name>
> <url-pattern>/</url-pattern>
> </servlet-mapping>
>
> The above code works (hooray), but if I try to change the url pattern  
> to anything more specific (such as /login, or /login*, or /login/*) I  
> get the wrong action parameter value . . .
>
>
>
> atta-ur rehman wrote:
>
>> Okay, now you need to show your web.xml!
>>
>> struts-config.xml looks fine. I'd suggest you try it with .do  
>> extension first and then try path mapping in web.xml
>>
>> ATTA
>>
>> On Jul 5, 2004, at 4:40 PM, Erik Weber wrote:
>>
>>> <form-beans>
>>> <form-bean name="loginForm"  
>>> type="org.apache.struts.validator.DynaValidatorForm">
>>> <form-property name="username" type="java.lang.String"/>
>>> <form-property name="password" type="java.lang.String"/>
>>> </form-bean>
>>> </form-beans>
>>>
>>> <action-mappings>
>>> <action path="/login" type="LoginAction" name="loginForm"  
>>> scope="session" input="/login.jsp">
>>> <forward name="success" path="/home.jsp"/>
>>> <forward name="failure" path="/login.jsp"/>
>>> </action>
>>> </action-mappings>
>>>
>>> <message-resources parameter="ApplicationResources"/>
>>>
>>>
>>> I have tried mapping the controller servlet to all kinds of path  
>>> prefixes including "/login" and "/login/*" and "/". None of them  
>>> result in the correct action parameter in the form. I don't want to  
>>> use extension mapping. I want to use path mapping. Is this where the  
>>> problem is?
>>>
>>>
>>>
>>> atta-ur rehman wrote:
>>>
>>>> Hello Erik,
>>>>
>>>> Is it possible for you to show your struts-config.xml file?
>>>>
>>>> ATTA
>>>>
>>>> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>>>>
>>>>> Could someone please tell me what would cause the html:form tag to  
>>>>> ignore the value I specify to the action parameter, and instead,  
>>>>> rewrite the action parameter value to be equal to the context root  
>>>>> of the application?
>>>>>
>>>>>
>>>>> For example, my web app login page is:
>>>>>
>>>>> http://localhost:8080/Test/index.jsp
>>>>>
>>>>> In login.jsp, I have this opening form tag:
>>>>>
>>>>> <html:form action="/login">
>>>>>
>>>>> I have a matching action configured in struts-config.xml. But the  
>>>>> struts tag is rendering the form tag like this:
>>>>>
>>>>> <form name="loginForm" action="/Test">
>>>>>
>>>>>
>>>>> No matter what I try this does not change. This is extremely  
>>>>> frustrating. Any help would be appreciated.
>>>>>
>>>>> Erik
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------- 
>>>>> --
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: Form tag problem

Posted by Erik Weber <er...@mindspring.com>.
Thanks for helping.

I assume you mean this part:

<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

The above code works (hooray), but if I try to change the url pattern to 
anything more specific (such as /login, or /login*, or /login/*) I get 
the wrong action parameter value . . .



atta-ur rehman wrote:

> Okay, now you need to show your web.xml!
>
> struts-config.xml looks fine. I'd suggest you try it with .do 
> extension first and then try path mapping in web.xml
>
> ATTA
>
> On Jul 5, 2004, at 4:40 PM, Erik Weber wrote:
>
>> <form-beans>
>> <form-bean name="loginForm" 
>> type="org.apache.struts.validator.DynaValidatorForm">
>> <form-property name="username" type="java.lang.String"/>
>> <form-property name="password" type="java.lang.String"/>
>> </form-bean>
>> </form-beans>
>>
>> <action-mappings>
>> <action path="/login" type="LoginAction" name="loginForm" 
>> scope="session" input="/login.jsp">
>> <forward name="success" path="/home.jsp"/>
>> <forward name="failure" path="/login.jsp"/>
>> </action>
>> </action-mappings>
>>
>> <message-resources parameter="ApplicationResources"/>
>>
>>
>> I have tried mapping the controller servlet to all kinds of path 
>> prefixes including "/login" and "/login/*" and "/". None of them 
>> result in the correct action parameter in the form. I don't want to 
>> use extension mapping. I want to use path mapping. Is this where the 
>> problem is?
>>
>>
>>
>> atta-ur rehman wrote:
>>
>>> Hello Erik,
>>>
>>> Is it possible for you to show your struts-config.xml file?
>>>
>>> ATTA
>>>
>>> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>>>
>>>> Could someone please tell me what would cause the html:form tag to 
>>>> ignore the value I specify to the action parameter, and instead, 
>>>> rewrite the action parameter value to be equal to the context root 
>>>> of the application?
>>>>
>>>>
>>>> For example, my web app login page is:
>>>>
>>>> http://localhost:8080/Test/index.jsp
>>>>
>>>> In login.jsp, I have this opening form tag:
>>>>
>>>> <html:form action="/login">
>>>>
>>>> I have a matching action configured in struts-config.xml. But the 
>>>> struts tag is rendering the form tag like this:
>>>>
>>>> <form name="loginForm" action="/Test">
>>>>
>>>>
>>>> No matter what I try this does not change. This is extremely 
>>>> frustrating. Any help would be appreciated.
>>>>
>>>> Erik
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Form tag problem

Posted by atta-ur rehman <at...@numetrics.com>.
Okay, now you need to show your web.xml!

struts-config.xml looks fine. I'd suggest you try it with .do extension 
first and then try path mapping in web.xml

ATTA

On Jul 5, 2004, at 4:40 PM, Erik Weber wrote:

> <form-beans>
> <form-bean name="loginForm" 
> type="org.apache.struts.validator.DynaValidatorForm">
> <form-property name="username" type="java.lang.String"/>
> <form-property name="password" type="java.lang.String"/>
> </form-bean>
> </form-beans>
>
> <action-mappings>
> <action path="/login" type="LoginAction" name="loginForm" 
> scope="session" input="/login.jsp">
> <forward name="success" path="/home.jsp"/>
> <forward name="failure" path="/login.jsp"/>
> </action>
> </action-mappings>
>
> <message-resources parameter="ApplicationResources"/>
>
>
> I have tried mapping the controller servlet to all kinds of path 
> prefixes including "/login" and "/login/*" and "/". None of them 
> result in the correct action parameter in the form. I don't want to 
> use extension mapping. I want to use path mapping. Is this where the 
> problem is?
>
>
>
> atta-ur rehman wrote:
>
>> Hello Erik,
>>
>> Is it possible for you to show your struts-config.xml file?
>>
>> ATTA
>>
>> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>>
>>> Could someone please tell me what would cause the html:form tag to 
>>> ignore the value I specify to the action parameter, and instead, 
>>> rewrite the action parameter value to be equal to the context root 
>>> of the application?
>>>
>>>
>>> For example, my web app login page is:
>>>
>>> http://localhost:8080/Test/index.jsp
>>>
>>> In login.jsp, I have this opening form tag:
>>>
>>> <html:form action="/login">
>>>
>>> I have a matching action configured in struts-config.xml. But the 
>>> struts tag is rendering the form tag like this:
>>>
>>> <form name="loginForm" action="/Test">
>>>
>>>
>>> No matter what I try this does not change. This is extremely 
>>> frustrating. Any help would be appreciated.
>>>
>>> Erik
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: Form tag problem

Posted by Erik Weber <er...@mindspring.com>.
<form-beans>
<form-bean name="loginForm" 
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="username" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
</form-bean>
</form-beans>

<action-mappings>
<action path="/login" type="LoginAction" name="loginForm" 
scope="session" input="/login.jsp">
<forward name="success" path="/home.jsp"/>
<forward name="failure" path="/login.jsp"/>
</action>
</action-mappings>

<message-resources parameter="ApplicationResources"/>


I have tried mapping the controller servlet to all kinds of path 
prefixes including "/login" and "/login/*" and "/". None of them result 
in the correct action parameter in the form. I don't want to use 
extension mapping. I want to use path mapping. Is this where the problem is?



atta-ur rehman wrote:

> Hello Erik,
>
> Is it possible for you to show your struts-config.xml file?
>
> ATTA
>
> On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:
>
>> Could someone please tell me what would cause the html:form tag to 
>> ignore the value I specify to the action parameter, and instead, 
>> rewrite the action parameter value to be equal to the context root of 
>> the application?
>>
>>
>> For example, my web app login page is:
>>
>> http://localhost:8080/Test/index.jsp
>>
>> In login.jsp, I have this opening form tag:
>>
>> <html:form action="/login">
>>
>> I have a matching action configured in struts-config.xml. But the 
>> struts tag is rendering the form tag like this:
>>
>> <form name="loginForm" action="/Test">
>>
>>
>> No matter what I try this does not change. This is extremely 
>> frustrating. Any help would be appreciated.
>>
>> Erik
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Form tag problem

Posted by atta-ur rehman <at...@numetrics.com>.
Hello Erik,

Is it possible for you to show your struts-config.xml file?

ATTA

On Jul 5, 2004, at 4:01 PM, Erik Weber wrote:

> Could someone please tell me what would cause the html:form tag to 
> ignore the value I specify to the action parameter, and instead, 
> rewrite the action parameter value to be equal to the context root of 
> the application?
>
>
> For example, my web app login page is:
>
> http://localhost:8080/Test/index.jsp
>
> In login.jsp, I have this opening form tag:
>
> <html:form action="/login">
>
> I have a matching action configured in struts-config.xml. But the 
> struts tag is rendering the form tag like this:
>
> <form name="loginForm" action="/Test">
>
>
> No matter what I try this does not change. This is extremely 
> frustrating. Any help would be appreciated.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: Form tag problem

Posted by Axel Groß <ka...@iaeste.at>.
so what is the path under which you would like to access the action?
(like you would typ it into the browser)
we could give you the right mapping

On 2004-07-05 at 19:24:50 -0400, Erik Weber wrote:
> 1) Typo: I meant that my login page is:
> 
> http://localhost:8080/Test/login.jsp, not index.jsp.
> 
> 2) I am finding that playing around with the servlet mappings in web.xml 
> is having an effect on what is rendered as the value of the action 
> parameter, but I still cannot make any sense of it.
> 
> If anyone could explain how this works I would appreciate it. I don't 
> want to download 10MB of source code just to look at one file.
You should download it anyway, if you want to use struts.
If you want things to be done in the non-standard way,
you'll have to tweak (extend) it.

ciao,
axel
> 
> Erik
> 
> 
> 
> Erik Weber wrote:
> 
> >Could someone please tell me what would cause the html:form tag to 
> >ignore the value I specify to the action parameter, and instead, 
> >rewrite the action parameter value to be equal to the context root of 
> >the application?
> >
> >
> >For example, my web app login page is:
> >
> >http://localhost:8080/Test/index.jsp
> >
> >In login.jsp, I have this opening form tag:
> >
> ><html:form action="/login">
> >
> >I have a matching action configured in struts-config.xml. But the 
> >struts tag is rendering the form tag like this:
> >
> ><form name="loginForm" action="/Test">
> >
> >
> >No matter what I try this does not change. This is extremely 
> >frustrating. Any help would be appreciated.
> >
> >Erik
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


Re: Form tag problem

Posted by Erik Weber <er...@mindspring.com>.
1) Typo: I meant that my login page is:

http://localhost:8080/Test/login.jsp, not index.jsp.

2) I am finding that playing around with the servlet mappings in web.xml 
is having an effect on what is rendered as the value of the action 
parameter, but I still cannot make any sense of it.

If anyone could explain how this works I would appreciate it. I don't 
want to download 10MB of source code just to look at one file.

Erik



Erik Weber wrote:

> Could someone please tell me what would cause the html:form tag to 
> ignore the value I specify to the action parameter, and instead, 
> rewrite the action parameter value to be equal to the context root of 
> the application?
>
>
> For example, my web app login page is:
>
> http://localhost:8080/Test/index.jsp
>
> In login.jsp, I have this opening form tag:
>
> <html:form action="/login">
>
> I have a matching action configured in struts-config.xml. But the 
> struts tag is rendering the form tag like this:
>
> <form name="loginForm" action="/Test">
>
>
> No matter what I try this does not change. This is extremely 
> frustrating. Any help would be appreciated.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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