Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3283988
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:06:14+00:00 2026-05-17T20:06:14+00:00

I want to redirect from a link in a JSF page, how can I

  • 0

I want to redirect from a link in a JSF page, how can I do it?

In HTML I can use <a> tag for this. But in JSF I use <h:outputLink> or <h:commandLink> as they can be conditionally rendered. I want redirect link to other page in same application or to an external URL. How can I do it with JSF? How can I use action in <h:commandLink> for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:06:15+00:00Added an answer on May 17, 2026 at 8:06 pm

    Assuming that you’d like to redirect to some.xhtml which is placed in web root folder:

    1. You can just continue using plain HTML.

       <a href="#{request.contextPath}/some.xhtml">go to some page</a>
      

      For conditional rendering, just wrap it in an <ui:fragment>.


    2. Or use <h:link> with implicit navigation.

       <h:link outcome="/some" value="go to some page" />
      

      Note: no need to prepend context path nor to include FacesServlet mapping.


    3. Or use <h:commandLink> with ?faces-redirect=true.

       <h:commandLink action="/some?faces-redirect=true" value="go to some page" />
      

      Note: no need to prepend context path nor to include FacesServlet mapping.


    4. Or use <h:outputLink>, but you need to specify context path.

       <h:outputLink value="#{request.contextPath}/some.xhtml" value="go to some page" />
      

    Redirecting to an external URL is already answered in this duplicate: Redirect to external URL in JSF.

    See also:

    • How to navigate in JSF? How to make URL reflect current page (and not previous one)
    • When should I use h:outputLink instead of h:commandLink?
    • JSF implicit vs. explicit navigation
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to create an html link using h:outputLink, other JSF tag
Iam working on Ubuntu.(Linux) I want to redirect from the page one.php to two.php,
I want to 301 redirect from: www.olddomain.com to the root of newdomain.com but I
I want to make my php page only accessible from another page redirect and
I want to download Rar file from another server. If I use a tag
I'm using Mod Rewrite for IIS 7.0 from iis.net and want to redirect requests:
From a Console Application project in Visual Studio , I want to redirect Console
I want to redirect using .htaccess abc.com/test.php to abc.com/test . but it will execute/display
I want to redirect to home page if session get invalid. My spring-servlet.xml is
I want to redirect the user to next page afte successfully submitting their information

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.