File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes How to force JSP processing, before a dialog opens? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to force JSP processing, before a dialog opens?" Watch "How to force JSP processing, before a dialog opens?" New topic
Author

How to force JSP processing, before a dialog opens?

Grae Cullen
Greenhorn

Joined: Jan 21, 2010
Posts: 19
Hi all,

I am trying to use several dialogs on a single page. I would like to do a bit of processing on the server, before displaying these dialogs. The problem is I am working with a components library that used JavaScript to open the dialog. The dialogs are the hidden div, iframe stuff.

This seems like I have to do the processing for all the dialogs on that page every time the page opens. If I have five different dialogs, it seems like wasted processing.

However, if I user pop-ups the new window can do JSP processing, and the processing for each dialog does not affect some other dialog's processing.

That being said, I kind of would like to use these floating div type dialogs. People don't like pop-ups and all. Plus the dialog component actually looks pretty good.

Grae
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Grae Cullen wrote: People don't like pop-ups and all.


And some of us have our browsers set to open new windows as tabs, so the popups don't actually "pop up".

I'm not entirely clear what your problem is here. You can do the basic dialog (div) layout statically, then invoke a setup method in the logic that pops up the dialog to reduce the need for redundant client-side processing. That's a strategy that works equally well in both JSPs and in JSF Views.


Customer surveys are for companies who didn't pay proper attention to begin with.
Grae Cullen
Greenhorn

Joined: Jan 21, 2010
Posts: 19
I'm not entirely clear what your problem is here. You can do the basic dialog (div) layout statically, then invoke a setup method in the logic that pops up the dialog to reduce the need for redundant client-side processing. That's a strategy that works equally well in both JSPs and in JSF Views.


I am not following what you mean. When you say "setup method" do you mean JavaScript or server side. Currently, when the dialog popups open, a JavaScript function is called. However, the dialog is just hidden. The values have already been populated from the backing beans long ago.

Suppose I writing an email application for example. There are 20 emails on the page. The user selects an email, and clicks the view headers button. How can the dialog give information about that email? I suppose I could have twenty copies of dialog sitting there waiting to be opened, but that sounds tricky.

I really need to submit something to the server, and have the server produce the dialog right then. I don't mean the basic dialog can't still sit there in a hidden div. However, the information to populate that dialog has to be fresh.

Thanks,
Grae

PS: The email program is just an example.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

In a case like what you're describing, AJAX can do the trick. Basically, your dialog display logic would make an AJAX request to the server to get the data you want to display and fill in the dialog with that data before making it visible.

You didn't say what you're intending to use for dialog support, but the RichFaces dialog can do this quite effectively. I've also used dojo, but that was on a project where I didn't have JSF to make life more pleasant.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to force JSP processing, before a dialog opens?
 
Similar Threads
One more jsp:include Question
Too many window.open calls cause problem?
What technique to use in place of a pop up?
JSF Popup from JSP page
How to determine where to position a jQuery UI dialog?