0

In the below mentioned Project I want to retrieve below mentioned forward path marked in Yellow. Is it possible?
enter image description here

I have tried to do this - String af = mapping.getPath();

But this actually returns the below mentioned marked in Yellow.
enter image description here

I tried using mapping.getPath();

But its actually returning Action path instead of the Forward path.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Abhinav
  • 23
  • 2
  • Don't post the code in images. – Roman C Aug 16 '23 at 15:51
  • 1
    [Please post code/errors/etc as formatted text instead of links to images of formatted text.](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question/285557#285557) – Dave Newton Aug 16 '23 at 16:00
  • 1
    **Why** do you want this? It **sounds** like something bad is happening. In any case: `ActionMapping#findForward` returns the `ActionForward` associated w/ the name. The docs are your friend. – Dave Newton Aug 16 '23 at 16:03

1 Answers1

0

To get the forward path from the action config you can use Struts API.

ActionMapping::findForward() returns the ForwardConfig object mapped to the action config or a global forward.

Find and return the ForwardConfig instance defining how forwarding to the specified logical name should be handled. This is performed by checking local and then global configurations for the specified forwarding configuration. If no forwarding configuration can be found, return null.

Now, you can get the forward by name

ActionForward forward = mapping.findForward("hello1");
String path = forward.getPath();
Roman C
  • 49,761
  • 33
  • 66
  • 176