• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts and new page validation

 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merill,
I think you are right. Thanks for your input.
Thanks,
kundan
reply
    Bookmark Topic Watch Topic
  • New Topic