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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-------------------------------------------------------------------- -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to