問題タブ [requestcontext]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - RequestContext.getCurrentInstance().execute() が Javascript 関数を実行していない
私はしばらくこれをいじっていましたが、これを機能させることができませんでした。おそらく私が正しく理解していないことがあります。マネージド Bean の Java コードから Javascript 関数を呼び出したいと考えています。onSubmit メソッドは次のようになります: (ブレークポイントを設定することで、このコードが実行されていることがわかります)
showOrHideModal 関数は、xhtml の先頭にある .js ファイル内にあります。xhtml のボタンは次のようになります。
Bean でこのコードが必要な理由は、後でいくつかの検証を実行し、この Javascript を条件付きで実行してモーダル ウィンドウを表示する必要があるためです。
デバッグ中にボタンをクリックしても何のフィードバックも得られないので、問題を探し始めるのが難しいです。Javascript 関数に console.writeLine も追加しました。それが役立つ場合、私のIDEはIntelliJ 14.1.4です-これをデバッグする方法を見つけたいです。
また、私の全体的な問題に対して別の解決策が見られる場合は、お知らせください。この問題について、私は視野狭窄を形成したかもしれません。
multithreading - Threading with primefaces tree
I have a problem of loading large data set to a primefaces tree.
Background
I have a large data set, one big list of hashmaps to be specific. I need to loop over every element of the list to build the tree in the PostConstruct method for primefaces to display. Just looping over the list takes around 4 minutes.
How I am dealing with this
So, I thought of dividing the loop among a number of threads (yeah, the process in this context is divisible) to enhance performance. I create threads where every thread loops over a portion of the list building part of the tree (a tree node per loop per thread). This makes the processing goes down to roughly a minute. I want to further enhance the solution by displaying part of the tree (like 100 nodes) on startup and then let the threads do their work keeping the page responsive to the end user. Each thread, after every loop (i.e. after creating a tree node), should fire some kind of event (trigger a method) for primefaces to update the tree with the newly created node. And this is where I need help.
The Problem
I cannot find a way to programmatically tell primefaces to update the tree. I learned that RequestContext is used for such a purpose, but the problem is it fails when it's called from another thread. So I was wondering if you have better approach to solve this problem or maybe tell me what I am missing.
Simple Demo Code
xhtml file looks like this
Managed Bean looks like this
The background thread looks like this:
This really works in terms of adding new items to the tree. But I cannot invoke anything to programmatically update the tree in primefaces. I mean, the object root (of type TreeNode in the managed bean) gets updated, but this is not reflected in the xhtml page.
Specs
I'm using JSF 2.2 with primefaces 5.3.
java - RequestContext.getCurrentInstance().update が機能しない
ダイアログを表示し、データテーブルからデータを表示するためのコマンドボタンを備えた JSF ページがありますが、問題 RequestContext.getCurrentInstance().update がダイアログを更新しません。
ここに私のJSFコードがあります
ここに私のマネージドビーンがあります
java - スレッド間の Spring mvc リクエスト スコープ コンテキスト
春のMVC Webアプリケーションでは、ユーザー情報をリクエストスコープに保存したい.ファイラーまたはインターセプターで、ユーザー情報を作成して保存し、後でこのリクエスト内で使用します.春にリクエストスコープのSpring Beanを作成できることを知っていますただし、これらの Bean はリクエスト スレッド内 (おそらく子スレッド) 内でのみアクセスできます。ただし、スレッド プール内のユーザー情報にアクセスします。そのため、リクエスト スコープの Spring Bean でビルドすることは、私には適していない可能性があります。リクエスト範囲内のスレッド間で店舗情報を共有するコツは?</p>