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 6873443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:04:08+00:00 2026-05-27T04:04:08+00:00

i am using PrettyFaces 3.3.0 and i want to make custom redirect and forward

  • 0

i am using PrettyFaces 3.3.0
and i want to make custom redirect and forward from a servlet

i found the following code on their documentation:

public class CustomRedirector 
{
    public void redirect(HttpServletRequest request, HttpServletResponse response, 
                            String mappingId, Map<String, String[]>params)
    {
        PrettyContext context = PrettyContext.getCurrentInstance(request);
        PrettyURLBuilder builder = new PrettyURLBuilder();

        URLMapping mapping = context.getConfig().getMappingById(mappingId);
        String targetURL = builder.build(mapping, params);

        targetURL = response.encodeRedirectURL(targetURL);
        response.sendRedirect(targetURL);
    }       
}

and i was wondering how to call the redirect method from the servlet, what will be the mappingId (the requestURI ?) and what will be the value of Map<String, String[]>params, i need a small example please of calling above method from a servlet?

and how to do forwarding from servlet with prettyfaces too, please advise.

  • 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-27T04:04:09+00:00Added an answer on May 27, 2026 at 4:04 am

    The “String mappingId” is the ID of the url-mapping in your PrettyFaces configuration. Each url-mapping should have an ID (either in the XML, or the Annotations configuration.)

    The Map params is a list of parameters in name-value pairs that is used to generate the outbound link based on the URL-mapping pattern specified by the id.

    For example:

    <url-mapping id="foo">
        <pattern value="/#{cat}/#{item}" />
        <view-id value="/bar.xhtml" />
    </url-mapping>
    

    So you would call your method like so:

    Map<String, String[]> map = new HashMap<>();
    map.put("cat", "blah");
    map.put("item", "45");
    new CustomRedirector.redirect(request, response, "foo", map);
    

    And you will be redirected to:

    /blah/45
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the moment I am using the following code: public void init() { question
I see that many sites are using the same template of documentation: PrettyFaces Hibernate
Using AddRange in a ListView When you have a custom collection and want to
i'm using prettyfaces 3.1.0 with JSF1.2 and Seam 2.2.0. I have the following pretty-config.xml:
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using restlet, I want to make a post to android's c2dm service. I have
i'm using prettyfaces 3.3.2 and JSF 2.2.1. i want to convert pretty url string
using chrome 15 on osx 10.6.8 When adding event listeners, I've found that putting
Using delphi 2010, i am wondering if there someway to escape the following string
Using VBScript, I want to add an additional button to Notepad labeled send .

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.