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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:02:09+00:00 2026-05-28T00:02:09+00:00

How can ı kep parameter in XHMTL file. for example ı want to kep

  • 0

How can ı kep parameter in XHMTL file.

for example ı want to kep parameter like

….param name= “name” value=”john”….

then the other line ı want to print it with calling name parameter.

I want to do this.
I have a problem with calling multiple times a sessionscoped bean.

I will solve this way.

the Login Bean is here :

@ManagedBean(name = "UserLogin")
@RequestScoped
public class Login {

@ManagedProperty(value="#{LoggedUser}")
private LoginUser loginUser;
private String username = null;
private String password = null;
private String message = null;
private Boolean isLoggedin = false;
private Boolean isAdmin = false;
private User loggedinUser = null;

public User getLoggedinUser() {
    this.loggedinUser = loginUser.getLoggedUser();
    return loggedinUser;
}

public void setLoggedinUser(User loggedinUser) {
    this.loggedinUser = loggedinUser;
}

public LoginUser getLoginUser() {
    return loginUser;
}

public void setLoginUser(LoginUser loginUser) {
    this.loginUser = loginUser;
}

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}

public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

public String getMessage() {
    return message;
}

public void setMessage(String message) {
    this.message = message;
}

public Boolean getIsLoggedin() {
    if(this.loginUser.getLoggedUser() != null){
        this.isLoggedin = true;
    }
    else{
        this.isLoggedin = false;
    }
    return isLoggedin;
}

public void setIsLoggedin(Boolean isLoggedin) {
    this.isLoggedin = isLoggedin;
}

public Boolean getIsAdmin() {
    if(this.loginUser.getLoggedUser() != null){
        if(this.loginUser.getLoggedUser().getAdmin()){
            this.isLoggedin = true;
        }
        else{
            this.isLoggedin = false;
        }
        this.isLoggedin = true;
    }
    else{
        this.isLoggedin = false;
    }
    return isAdmin;
}

public void setIsAdmin(Boolean isAdmin) {
    this.isAdmin = isAdmin;
}

public void doLogin() {
    System.out.println(username+"");
    System.out.println(password+"");
    System.out.println(isLoggedin+"");
    RequestContext context = RequestContext.getCurrentInstance();
    SessionFactory sessionFactory = HibernateUtil.getSessionFactory();// static

    Session hiberSession = sessionFactory.openSession();// session a çevir

    ArrayList<User> userList = null;

    try {
        Criteria crt = hiberSession.createCriteria(User.class);
        crt.add(Restrictions.eq("username", this.username));
        crt.add(Restrictions.eq("password", this.password));
        userList = (ArrayList<User>) crt.list();
        if (userList.size() == 0) {
            this.message = "Incorrect username or password!";
            this.isLoggedin = false;
            this.isAdmin = false;
        } else {
            this.loggedinUser = userList.get(0);
            this.loginUser.setLoggedUser(loggedinUser);
            this.isLoggedin = true;
            this.isAdmin = userList.get(0).getAdmin();
            this.message = "";
            FacesContext.getCurrentInstance().addMessage(
                    null,
                    new FacesMessage(FacesMessage.SEVERITY_INFO,                                     "Welcome,"
                            + this.loggedinUser.getName() + " ("
                            +       this.loggedinUser.getUsername() + ")", ""));
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        hiberSession.flush();
        hiberSession.close();
    }
    context.addCallbackParam("isLoggedIn", isLoggedin);
    context.addCallbackParam("isAdmin", isAdmin);
    context.addPartialUpdateTarget("growl");
}

public void doLogout() {
    this.loginUser.setLoggedUser(null);
    this.isAdmin = false;
    this.isLoggedin = false;
}

public void registerLogin(User user) {
    setUsername(user.getUsername());
    setPassword(user.getPassword());
    doLogin();
}

The XML PART is Here :

    <p:outputPanel id="loginOut">
                                            <p:panel id="loginPanel" header="User Login"        align="center"
                                                rendered="#{LoggedUser.getLoggedUser == null}"
                                                style="text-align:center; margin-bottom:10px;">
                                                <h:form>
                                                    <div style="padding: 6px">

                                                        <div>
                                                            <table style="width: 100%; text-align: left;"
                                                                align="left">
                                                                <tr>
                                                                    <td><h:outputLabel for="loginusername"
                                                                            value="Username : &nbsp;" /></td>
                                                                </tr>
                                                                <tr>
                                                                    <td><p:inputText id="loginusername"
                                                                            value="#{UserLogin.username}" size="26"
                                                                            label="Name and Surname" /> <p:watermark
                                                                            for="loginusername" value="Username" /></td>
                                                                </tr>
                                                                <tr>
                                                                    <td><h:outputLabel for="loginpassword"
                                                                            value="Password : &nbsp;" /></td>
                                                                </tr>
                                                                <tr>
                                                                    <td><p:keyboard id="loginpassword"
                                                                            value="#{UserLogin.password}" size="26"
                                                                            label="Password" password="true" keypadOnly="false" />

                                                                        <p:watermark for="loginpassword" value="Password" /></td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                        <div>
                                                            <table style="width: 100%; padding-top: 5px;">
                                                                <tr>
                                                                    <td><p:commandButton value="Register"
                                                                            image="ui-icon ui-icon-disk" id="loginLink"
                                                                            onclick="regdlg.show()" title="login">

                                                                        </p:commandButton></td>
                                                                    <td style="text-align: right; padding-right: 5px;">
                                                                        <p:commandButton value="Login"
                                                                            image="ui-icon ui-icon-arrow-1-ne"
                                                                            actionListener="#{UserLogin.doLogin()}"
                                                                            update="userPanelOut, adminPanelOut, loginmessage"
                                                                            oncomplete="handleLogin(xhr, status, args)" />

                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                        <div
                                                            style="padding-left: 5px; padding-bottom: 6px; padding-top: 6px; text-align: left;">

                                                            <p:commandLink value="I lost my password!"
                                                                onclick="recdlg.show()">
                                                            </p:commandLink>
                                                        </div>
                                                        <div style="padding-bottom: 6px; padding-top: 6px">
                                                            <h:outputText id="loginmessage"
                                                                value="#{UserLogin.message}">  </h:outputText>
                                                        </div>
                                                    </div>
                                                </h:form>
                                            </p:panel>

                                        </p:outputPanel>





                                        <p:outputPanel id="userPanelOut">
                                            <p:panel id="rightUserPanel" header="User Panel"
                                                align="center"
                                                style="text-align:center; margin-bottom:10px;"
                                                rendered="#{LoggedUser.getLoggedUser != null}">
                                                <div style="padding: 6px; height: auto; text-align: left;">
                                                    <ul class="ymenu">
                                                        <h:form>
                                                            <li><p:commandLink value="Edit Profile"
                                                                    onclick="profedlg.show()"
                                                                    style="display: block;text-decoration: none;color: #333;
                                                                    font-size: 14px;padding-left: 18px;padding-right: 18px;
                                                                padding-top: 10px;padding-bottom: 5px;
                                                                height: 20px;background-color: transparent;">

                                                                </p:commandLink></li>
                                                            <h:form>
                                                                <li><h:commandLink value="Logout"
                                                                        action="#{UserLogin.doLogout()}" oncomplate="refreshPage(xhr, status, args)"
                                                                        style="display: block;text-decoration: none;color: #333;
                                                                    font-size: 14px;padding-left: 18px;padding-right: 18px;
                                                                    padding-top: 10px;padding-bottom: 5px;
                                                                    height: 20px;background-color: transparent;">


                                                                        <f:ajax execute="" render="@all" />

                                                                    </h:commandLink></li>
                                                            </h:form>
                                                        </h:form>
                                                    </ul>
                                                </div>
                                            </p:panel>
                                        </p:outputPanel>


                                        <p:outputPanel id="adminPanelOut">

                                            <p:panel id="rightAdminPanel" header="Administration"
                                                align="center"
                                                style="text-align:center; margin-bottom:10px; text-align:center;"
                                                rendered="#{LoggedUser.getLoggedUser != null}">


                                                <div style="padding: 6px; height: auto; text-align: left;">
                                                    <ul class="ymenu">
                                                        <li><a href="edit_user.jsf">Users</a></li>
                                                        <li><a href="edit_category.jsf">Categories</a></li>
                                                        <li><a href="#">Posts</a></li>
                                                        <li><a href="#">Comments</a></li>
                                                        <li><a href="#">General Settings</a></li>

                                                    </ul>
                                                </div>
                                            </p:panel>
                                        </p:outputPanel>

                                        <p:outputPanel id="rightMenuOut">
                                        <p:panel id="rightCategoriesPanel" header="Categories"
                                            align="center"
                                            style="text-align:center; margin-bottom:10px;">
                                            <div style="padding: 6px; height: auto; text-align: left;">
                                                <ul class="ymenu">
                                                    <ui:repeat var="category" value="#{ListCategories.catList}">


                                                        <li><h:outputLink
                                                                value="#{ListCategories.getURL(category)}"
                                                                style="display: block;text-decoration: none;color: #333;
                                                                    font-size: 14px;padding-left: 18px;padding-right: 18px;
                                                                    padding-top: 10px;padding-bottom: 5px;
                                                                    height: 20px;background-color: transparent;">
                                                                <h:outputText value="#{category.name}" />
                                                            </h:outputLink></li>
                                                    </ui:repeat>
                                                    <li><a href="category.jsf?name=Uncategorized">Uncategorized</a></li>

                                                </ul>
                                            </div>
                                        </p:panel>
                                        </p:outputPanel>
  • 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-28T00:02:10+00:00Added an answer on May 28, 2026 at 12:02 am

    There might be better ways but you could try JSTL tags like <c:set name="name" value="john"/>.

    Note, however, that you need to keep in mind when JSTL tag handlers are evaluated and when JSF kicks in. Here’s an article that should help get you started with that: https://rogerkeays.com/jsf-c-foreach-vs-ui-repeat

    Additionally, you might want to tell us why you can’t call the bean multiple times. There might be an issue with your design that you could address. For example, try not to caluclate things in getters because they might be called more than once, even for a single expression on a page. Move those calculations/date retrievals to an action that is executed exactly once. Alternatively use a flag to check whether the data has already been calculated/retrieved.

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

Sidebar

Related Questions

Can I store an array such as [1,2,3,4] or some JSON like {name:John Johnson,street:Oslo,
Can glibc be compiled into one object file which can then be linked to
Can this be done? It seems like this should be possible. In general, I
Can anyone give me an example of how to return the following json simply
Can anyone tell me how to open Auto CAD file in HTML5? Is this
Can I run this in a Windows command prompt like I can run it
Can someone guide me on a possible solution? I don't want to use /bin/cp
Can we add custom language for RecognizerIntent? I have search many SO Question like
can someone show me the regex for this preg_match. I want to make sure
Can I convert a pdf to pcl file with ghostscript? I'm using Ghostscript 9.01

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.