• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

struts forwarding problem.

I have a link on a webpage called customers, this is what the code looks like in the html page

<html:link action="/customer">Customer</html:link>

in struts-config.xml I have the following defined for this
<action path="/customer"
                type="org.apache.struts.actions.ForwardAction"
                parameter="customer.page" />

where customer.page is defined is tiles-def.xml and everything works fine.

I want to achieve the same effect, but in the action class when I do a return. I tried

return mapping.findForward("/customer"); //did not work
return new ActionForward("/customer"); //did not work

how do i see the same page that I could see by clicking on the Customer link.

Thanks in advance.
0
muthiahmerchant
Asked:
muthiahmerchant
  • 2
1 Solution
 
suprapto45Commented:
Hi,

Try to add .do at the end
return new ActionForward("/customer.do");

And I do not think that the first one is correct. if you would like to use the first one, you can specify the <forward name
return mapping.findForward("callCustomer");

then in your struts-config.xml and within your Action definition
<forward name="callCustomer" path="/customer.do" />

David
0
 
muthiahmerchantAuthor Commented:
customer.do worked.

Thanks a lot.

0
 
geek4uCommented:
Try this:

Action mapping in struts-config.xml:

<action
            path="/customer"
            type="[put Action classpath here]"
            parameter="customer.page">
            <forward name="success" path="/customer.do" redirect="false" />
        </action>

In the action class:

return mapping.findForward("success");
0
 
suprapto45Commented:
;)

Glad I could help

David
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now