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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:12:14+00:00 2026-05-23T07:12:14+00:00

How can I access the view parameters from a viewscoped bean? I have a

  • 0

How can I access the view parameters from a viewscoped bean?
I have a page almost with the same content as this:

<f:metadata>
    <f:viewParam name="name" value="#{goToUserpageRequest.name}" />
</f:metadata>

<ui:define name="content">
    <h:outputText value="#{user.name}" styleClass="text"></h:outputText>
    <h:outputText value="#{user.description}" styleClass="text"></h:outputText>
</ui:define>

GoToUserpageRequest is a bean which I use to redirect to this page, so I can send the value for name.
User is my viewscoped bean. I want to pass the value of viewParam name to user.name. How can I do that?
Thanks in advance!

  • 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-23T07:12:15+00:00Added an answer on May 23, 2026 at 7:12 am

    You can get this information using the external context from your context. See the request parameters.

    However, I would try to use a request scope bean and inject the view and parameter scope values into that. You can then manipulate your view scoped object from there. This approach is easier to unit test.


    EDIT:

    Here is a sample implementation:

    @ManagedBean @RequestScoped
    public class NameUpdater {
        @ManagedProperty("#{param.name}") private String name;
        public String getName() { return name; }
        public void setName(String name) { this.name = name; }
    
        @ManagedProperty("#{user}") private User user;
        public User getUser() { return user; }
        public void setUser(User user) { this.user = user; }
    
        @PostConstruct public void init() {
            if(name != null) user.setName(name);
        }
    }
    

    In order to create the request scoped bean, the binding expression would change to something like:

    <h:outputText value="#{nameUpdater.user.name}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I access a controller instance from the view? E.g. I have a
i have view like 'home/details/5', it can be access by anonymous user. but there
I have an Ms Access view(query) as following select * from employee Where EmployeeId=SomeID
I have a textbox in grid view created dynamically. We can access the user
I can access and show self.view and see the frame in the log but
I can access the database either from a .NET program (using ODBC) or through
I know you can access the Contact Store from the SDk, but is it
How can I expose a Java bean to a JSP page by using struts?
I have a very simple table in access. The data is stored from VB.NET
Can you pass a parameter to a view's map function from the query part

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.