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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:22:21+00:00 2026-06-03T00:22:21+00:00

I have developed a simple login form to be used in my JSF +

  • 0

I have developed a simple login form to be used in my JSF + PrimeFaces page:

<form action="j_security_check" method="post"> 
    <p:dialog modal="true" header="Login" widgetVar="loginDlg">
        <h:panelGrid columns="3" cellpadding="5">  
            <h:outputLabel for="j_username">Username:</h:outputLabel> 
            <h:inputText id="j_username" required="true" /> 
            <h:message for="j_username" /> 
            <h:outputLabel for="j_password">Password:</h:outputLabel> 
            <h:inputSecret id="j_password" required="true" /> 
            <h:message for="j_password" /> 
            <br /> 
            <h:commandButton value="Login" /> 
        </h:panelGrid>
    </p:dialog>                
</form> 

Tried with an empty password, but the missing password (that is required) is not caught by h:message component. I have also switched to a p:commandButton thinking that the problem could have been in the Ajax behaviour of the button, but the page is not rendered because PrimeFaces complains about the CommandButton not being inside a form element. The exception thrown by the container is:

com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Access denied on empty password for user pippo

To summarize, I have 2 questions:

  1. Why the missing password doesn’t produce a message before the form is submitted?
  2. How can I catch a LoginException and display the error message inside the dialog?
  • 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-03T00:22:24+00:00Added an answer on June 3, 2026 at 12:22 am

    The j_security_check request is handled by the web container, not by JSF. That explains that the required="true" won’t work. It works only when you use JSF <h:form> and programmatic login by HttpServletRequest#login() in the action method associated with the command button.

    Best what you can do is to confiure a <form-error-page> in web.xml pointing to the very same URL as the <form-login-page>. You could then check if the request has been forwarded by j_security_check itself, which would mean that a login error has occurred.

    <h:panelGroup rendered="#{requestScope['javax.servlet.forward.servlet_path'] == '/j_security_check'}">
        <h:outputText value="Unknown login, please try again" styleClass="error" />
    </h:panelGroup>
    

    Use this instead of the <h:message>.

    As to why <p:commandButton> complains that there’s no form is simply because you didn’t use <h:form>.


    Unrelated to the concrete problem, that <form> (or <h:form> whenever you would decide to switch to programmatic login) can better be placed in the body of <p:dialog>, not outside. The <p:dialog> can by JS be relocated to end of body which would cause it not to be in a form anymore.

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

Sidebar

Related Questions

I have a very simple question. In FB tutorial https://developers.facebook.com/docs/mobile/ios/build/ it starts to login
I have developed a simple application using SDK(Android: 3.2[API-13]) for, to display Google banners.
I have developed a simple library in Ruby and need to use this in
I have developed a simple location aware iPhone application which is functionally working very
I am new to rails and have developed a simple rails application on my
On Windows 7, VB.NET Express, I have developed a simple Forms application. I don't
I have over 1000 clients and I developed a simple PHP script to loop
I have a simple windows Service developed in VS.net 2008 and VB.net. When I
I have a very simple windows Service that is developed in vb.net 2008. When
On a system I have developed It requires me to login using a standard

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.