0

My directory structure is like this.

-- dir
   -- dir1
      --file_1
   -- dir2
      --file_2

I have one jsf button as mentioned below.

<h:commandButton id="Register" style="background:#50A7E6;color:white" value="Register" action="../dir1/file_1?faces-redirect=true" class="btn btn-info loginmodal-submit"></h:commandButton>

I want to redirect from file_2 to file_1. As I mentioned in the action part, It should work but It is not redirecting to the page.

Can someone please help me?

Thanks.

stephen
  • 1
  • 4

1 Answers1

0

As it is well explained here and here, you cannot use JSF navigation on such way because JSF navigation is not relative to current directory but to application context.

And, in your case, p:commandButton is appending application context path to action parameter path and that is why it cannot work as you expect.

As far as I know, you can use, for example

 <h:outputLink value="../dir1/page1.xhtml">Go to DIR 1 Page 1</h:outputLink>

to browse relatively to directories (in your example, from /dir2/page2 to dir1/page1)

Dusan Kovacevic
  • 1,377
  • 1
  • 13
  • 19