Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dialog Boxes in Web Application

 
sanjeetha ashiqa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kiran Joshi
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
 
sanjeetha ashiqa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion Sean
Will try it .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jQuery UI provides easy-to-use dialogs.
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to do this on your own better start boning up on CSS!
 
sanjeetha ashiqa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic