File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts and new page validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts and new page validation" Watch "Struts and new page validation" New topic
Author

Struts and new page validation

kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
Hi All,
I want to display validation messages in a new window with control height and width. I dont want to use <html:form action="/client.do" target="_blank">
as this is not giving me control over html width height. Also if i want to open modal dialog, this code will not support.
Please Suggest
Thanks,
kundan


SCJP1.4,SCBCD,SCEA,CNA
Failures are practice shoots for success.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Since the approach you want varies radically from the way Struts normally handles validation, I'd recommend that you abandon the use of the struts validation framework and write your own validation in javascript and possibly AJAX.

If your validation can all be done on the client side (simple validations such as "is not blank" or "is integer") you can do it with just javaScript. If it is more complex (valid account number, etc.) use AJAX, which allows you to call server-side functions from javaScript. I've used an implementation of AJAX called DWR, and found it fairly easy to set up and use. Here is the link to download it: https://dwr.dev.java.net/

Basically, when you sense an error, you use the window.open() function of javascript to open a new window with a specified size and location. You can then format the window any way you want.

If you want a modal dialog box, Microsoft Internet Explorer has a showModalDialog() method in its version of javaScript that allows you to open a modal dialog box that is formatted however you want. I'm not sure if the other browsers have an equivalent function or not.
[ January 05, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
Thanks Merrill,
Ya i know AJAX or hidden frame approach to achieve this result. I used that approach heavily in my previous project.Thats why i thought of using that approach with struts framework. Is it not possible to achieve that with struts or is very complex.
Thanks,
kundan
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
My experience has been that if you are OK with the way struts handles validation (use of alert dialog boxes for client side validation and redisplay of the page with an error message for server side validation) then Struts validation works great.

If you want to vary from that format, it just isn't worth it to try and pound a square peg into a round hole. I've found that I'm better off writing my own validation the way I want it, rather than trying to make Struts validation vary from what it's designed to do.
kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
Hi Merill,
I think you are right. Thanks for your input.
Thanks,
kundan
 
Don't get me started about those stupid light bulbs.
 
subject: Struts and new page validation
 
Similar Threads
JButton redimension itself
Making translucent images
Resizing JFrame
Does this piece of code hang for you all also ?
Height and Width proportional algorithm?