Question

i have index page with redirect link to main page

<logic:redirect forward="welcome"/>

now my url looks like http://localhost:8081/task5/ProductsAction.do?method=categories

on main page i have form

<form action="/ProductsAction.do">
   <button name="method" value="subCategories"></button>
</form>

but url changes to http://localhost:8081/ProductsAction.do?method=subCategories

here is my action mapping in struts config

   <global-forwards>
        <forward name="welcome" path="/ProductsAction.do?method=categories" />
    </global-forwards>
    <action-mappings>

        <action parameter="method" path="/ProductsAction" name="ProductsForm"
            scope="request" validate="true"
            type="com.epam.app.presentation.action.ProductsAction">
            <forward name="categories" path="/pages/categories.jsp" />
            <forward name="subCategories" path="/pages/subCategories.jsp" />
            <forward name="products" path="/pages/products.jsp" />
        </action>

why does '/task5/' disappear from url?

Was it helpful?

Solution

Because you're using an absolute URL in a <form> tag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top