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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:53:52+00:00 2026-05-31T03:53:52+00:00

first I have to admit this might be a pretty specific problem. In a

  • 0

first I have to admit this might be a pretty specific problem. In a JavaServer Faces Application I want to be able to let a script run on the server-side interact with the user.

To give you more of a detail I give you an example of what I want to do:
In my application a user can input data and on the server side there is a script which can check/modify this data. I don’t know the exact script because the user is able to make a custom one. All in all so far there is no problem, but in the script it is possible to do interactions with the user in the way of a question dialog. In the following example, the further script execution depends on the answer of the user.

...

if( inputData.equals("Something") ){
    if( askUser("Question?","Some question...") )
    {
        doSomething();
    }
    else
    {
        doSomethingElse();
    }
}

...

As you can see the method “askUser” has to wait for the result before the script can continue. The script itself is a Beanshell-script and the method “askUser” is a Java method which is called by the Beanshell interpreter.

I had in my mind to use threads and Java synchronization methods to let the script pause, but thread creation is not allowed by EJB. Still I tried that way, but it failed due to the FacesContext not being available in user-created threads.

I hope I could make my intention clear and you have any idea how this could be done… 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-31T03:53:53+00:00Added an answer on May 31, 2026 at 3:53 am

    Your question demonstrates a complete misunderstanding of how not only JSF technology works, but also the inherently stateless nature of HTTP communication and web servers.

    Typically in a desktop based application this simple algorithm you listed above can be easily implemented, probably with modal dialogs and events. Web applications do not work this way because they are inherently stateless. A user or browser agent makes an HTTP request to a web server, the server processes this request and formulates a response, then returns that HTTP response back to the browser agent to be rendered. Typically this data can be textual, HTML, XML, Javascript, CSS, images or even a file.

    The problem with incorporating the algorithm above on a server is that the functionality for askUser cannot possibly be done by the server, because the server cannot just ask the user a question and wait for the response. That would be backwards. The user is the client and asks questions of the server.

    So how is this common problem solved in a web application? In JSF, the server can send as a response a Javascript to the browser that will allow the browser to ask the question, then when the user makes the choice, the Javascript can then post back the selection of the user to the server in an HTTP request. If that selection involves any changes to the DOM or page elements at all then that information will be sent in the response.

    JSF bridges the gap between desktop and web applications by allowing giving the illusion of desktop and event driven functionality to an otherwise stateless technology, and it does this by having an event lifecycle on the serverside and using Ajax to tightly control changes to document elements.

    A good tutorial on JSF technology can be found here, however I recommend becoming more familiar with HTTP and Java Servlets before you delve too deep: http://www.mkyong.com/tutorials/jsf-2-0-tutorials/

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

Sidebar

Related Questions

First of all I have to admit that my programming skills are pretty limited
First, I have to admit I screwed up a little with CVS. I had
First of all, I'll admit this is a school project, so I need more
First, I'll admit this is homework but it has been around six years since
First, I'll admit this is cross-posted at SuperUser but I decided to also post
I am trying to figure out how I might be able to do this
First of all, sorry if this might be a stupid question. I'm very new
I have this SSIS workflow defined. After I explain what I'm doing, it might
In order to bring up the menu for a DataGridViewComboBoxCell, I first have to
First I have a Listbox and set the DataSource to a MyObjectCollection MyObjectCollection implements

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.