File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Dialog Boxes in Web Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dialog Boxes in Web Application" Watch "Dialog Boxes in Web Application" New topic
Author

Dialog Boxes in Web Application

sanjeetha ashiqa
Greenhorn

Joined: Mar 11, 2010
Posts: 9
Hi,
I 'm developing a web application using Struts framework. I need to display alert messages or warning messages based on the input entered in a page.
currently I m implementing it using ActionMessages and I display the error message by forwarding the request to another jsp page and displaying it there but the problem is that I need to make it like a dialog box (alert,prompt) with the message and buttons in the same page where the input is entered. Can anyone suggest ideas.

Thanks in advance


Ashiqa
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Sanjeetha,
Welcome to the Ranch.

Your question would be more suited in the Struts forum.
CarefullyChooseOneForum
I have moved this thread there for you.

Also, please do take out time to read http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Kiran Joshi
Ranch Hand

Joined: Sep 04, 2005
Posts: 54
Try opening this second page using javascript like below.

window.showModalDialog()

I found a related link here
http://www.java2s.com/Code/JavaScript/Javascript-Objects/ShowModalDialogwindowshowModalDialogURLmyArguments.htm
sanjeetha ashiqa
Greenhorn

Joined: Mar 11, 2010
Posts: 9
Hi,

@Maneesh .. Sorry i was not aware of the forum categories as i am new and Thank you for the help .

@ Kiran.. Thanks for the reply . But it didnt solve my problem.
I will be accessing files respective of the input entered. So i m checking whether the file of the entered input is first existing or not , which i implemented in action.
If the file exists i forward the request to the page where i m going to read the file contents. else i need to display an alert message saying that the file of the chosen input does not exist , in the same page where i got the input. can this be implemented? any ideas?
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

@Maneesh - I'd say this was more a HTML/Javascript question than anything else.

Sanjeetha,
What you are asking to be done can of course be done and if you are lucky there may be a taglib available which will help you implementing this.

Otherwise you will be left having to use javascript + ajax.

If you do end up going down that route I recommend using a javascript library such as jQuery to simplify the process.

Sean


I love this place!
sanjeetha ashiqa
Greenhorn

Joined: Mar 11, 2010
Posts: 9
Thanks for the suggestion Sean
Will try it .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

jQuery UI provides easy-to-use dialogs.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Sean Clark wrote:@Maneesh - I'd say this was more a HTML/Javascript question than anything else.


Yup. Even I though as much. However the OP mentioned using Struts. Unfortunately I do not work on struts and suspected it might have some custom mechanism for dialogs.
sanjeetha ashiqa
Greenhorn

Joined: Mar 11, 2010
Posts: 9
The problem is I don't know jQuery.
But I would like to learn and try it to implement for my requirement.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It only has something to do with Struts once Struts enters into the picture--if it's a general question about dialog boxes then it's an HTML/JavaScript question.

I'm moving it to HTML/JavaScript for now; Struts has no general mechanism for dialog boxes. If there's a Struts-specific question, start a new thread in the Struts forum.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

If you want to do this on your own better start boning up on CSS!
sanjeetha ashiqa
Greenhorn

Joined: Mar 11, 2010
Posts: 9
I got the problem solved. I set a flag property for wrong entry of the filename in my action class and based on de property ,

i used <script> alert("Error " + <%= request.getAttribute("filename")%> + " is not available."); </script> in my jsp page inside <logic:equal property="flag" value="false">

Thanks guys!!

But <%= request.getAttribute("filename")%> returned null.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dialog Boxes in Web Application