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

  • Home
  • SEARCH
  • 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 8699255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:54:20+00:00 2026-06-13T01:54:20+00:00

I am working with creating PDF from XHTML with JSF 2.0 and iText. The

  • 0

I am working with creating PDF from XHTML with JSF 2.0 and iText. The page is simple registration form. When User enters all the data in the page and click on submit I have to get the whole HTML page source with user entered values into the bean. I used Jsoup to get the HTML but I got only HTML source not the values entered by the user.How can I do this?

My current code is

        FacesContext facesContext = FacesContext.getCurrentInstance();
        ExternalContext externalContext = facesContext.getExternalContext();
        HttpSession session = (HttpSession) externalContext.getSession(true);
        String url = "http://localhost:8080/Pro/faces/part1.xhtml;JSESSIONID=" + session.getId();
        try {
        Document doc = Jsoup.connect(url).get();
  • 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-06-13T01:54:21+00:00Added an answer on June 13, 2026 at 1:54 am

    Your Jsoup approach would only work if the managed bean holding the model data associated with the view is been stored in the session scope. Jsoup is namely firing a fresh new HTTP GET request, which thus means that it would in case of a request or view scoped bean get a brand new and entirely distinct instance, with all properties set to default.

    If you want to keep your bean in the request or view scope (very reasonable), then you’d need to temporarily put the model data in the session before the Jsoup call and remove it after the Jsoup call.

    Your another mistake is that you uppercased the JSESSIONID URL path fragment. It’s case sensitive and it should in fact be all lowercase: jsessionid.

    So, all with all, this should do if you want to keep your bean request or view scoped:

    @ManagedBean
    @ViewScoped
    public class Bean {
    
        @ManagedProperty("#{beanModel}") // Must match (unique!) session attribute name.
        private Model model;
    
        public void submit() throws IOException {
            ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
            HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
            HttpSession session = (HttpSession) externalContext.getSession(true);
            String url = request.getRequestURL().append(";jsessionid=").append(session.getId()).toString();
    
            session.setAttribute("beanModel", model);
            Document doc = Jsoup.connect(url).get();
            session.removeAttribute("beanModel");
    
            // ...
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a PDF file from raw binary data and it's working perfectly
I am working on creating thumbnail image from the first page of pdf file.
I'm working on creating PDF files in PHP with the R&OS PDF class (
I have iTextSharp creating a pdf for me in VB.net. Everything was working famously,
i'm working on creating an app that streams mp3s from a server. i'm using
working on creating an XML file with some data using Python. I am trying
I'm working on creating an HTML form that has an image in the background.
So I'm working on creating a very simple C program that just preforms shell
I am working on creating the ability to send data to a RESTful Rails
I m creating a pdf file on the server using iTextSharp. It is working

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.