?
Solved

struts forwarding problem.

Posted on 2006-05-22
4
Medium Priority
?
218 Views
Last Modified: 2010-03-31
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
Comment
Question by:muthiahmerchant
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
suprapto45 earned 2000 total points
ID: 16735749
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
 
LVL 1

Author Comment

by:muthiahmerchant
ID: 16735920
customer.do worked.

Thanks a lot.

0
 

Expert Comment

by:geek4u
ID: 16735932
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
 
LVL 16

Expert Comment

by:suprapto45
ID: 16739096
;)

Glad I could help

David
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question