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.
@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?
@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
posted
0
Thanks for the suggestion Sean Will try it .
Bear Bibeault
Author and opinionated walrus
Marshal
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
posted
0
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: 12612
posted
0
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 opinionated walrus
Marshal
If you want to do this on your own better start boning up on CSS!
sanjeetha ashiqa
Greenhorn
Joined: Mar 11, 2010
Posts: 9
posted
0
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.
This message was edited 2 times. Last update was at by sanjeetha ashiqa