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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:56:41+00:00 2026-05-27T17:56:41+00:00

I have a JSF 2.0 web project, my web have a form and it

  • 0

I have a JSF 2.0 web project, my web have a form and it have to do:

  1. Get the parametres of the form and save it in a Bean (Done)

  2. Get this information from the servlet:

    • Remote Address:
    • Remote Host:
    • Locale:
    • Content Type:
    • Boundary:
    • Content Length:
    • Character Encoding:
  3. Insert the Bean data and Servlet data in a table of a database (waiting step 2)

I dont know much about Servlets in JSF, i dont need if i have to make one or not. I only have the code of that but in JSP:

    String informe="";
    Enumeration a = request.getHeaderNames();
    while(a.hasMoreElements() ){
        String h = a.nextElement().toString();
        informe += h+": "+request.getHeader(h)+"\n";
    }
    a = request.getAttributeNames();
    while(a.hasMoreElements() ){
        String h = a.nextElement().toString();
        informe += h+": "+request.getHeader(h)+"\n";
    }
    informe += "Remote Address: "+request.getRemoteAddr()+"\n";
    informe += "Remote Host: "+request.getRemoteHost()+"\n";
    informe += "Locale: "+request.getLocale()+"\n";
    informe += "Content Type: "+request.getContentType()+"\n";
    informe += "Content Length: "+request.getContentLength()+"\n";
            .....
            ..

I don’t know how I can get the request information in JSF and wich steps I have to do. I readed a lot of pages but I think that I don’t need all things that they do.

  • 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-27T17:56:42+00:00Added an answer on May 27, 2026 at 5:56 pm

    The HttpServletRequest object is in JSF available by ExternalContext#getRequest().

    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
    // ...
    

    The ExternalContext by the way also offers some direct methods to get the desired information. Check the methods starting with getRequestXxx() such as getRequestHeaderMap(), getRequestContentType(), etc in the javadoc.

    You don’t need another servlet for this. JSF has already the FacesServlet as the sole request/response controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
I have easily created a JSF project with NetBeans that delivers a web service
I have a login page in a web application project: <h:form> <h:messages /> <h:inputText
I have a large non-Java EE, JSF-based web app project. Our system is layered
I have a JSF web client and a Java client that both use the
i have a JSF web application. I use Beans as Spring Beans (not JSF
I have a Java-JSF Web Application on GlassFish, in which I want to use
I have a JSF page that displays a RichFaces Treeview, from a TreeNodeImpl model
I have a War and Jar project in my Eclipse-based JSF project. I have
I have created simple Java Dynamic Web project in Eclipse. I host my project

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.