my dog learned polymorphism*
The moose likes Struts and the fly likes Struts 2 - implementing warning functionality 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 2 - implementing warning functionality" Watch "Struts 2 - implementing warning functionality" New topic
Author

Struts 2 - implementing warning functionality

Robert Atchison
Greenhorn

Joined: Dec 17, 2009
Posts: 2
Hello, I'm trying to get some ideas and best practices for implementing warning functionality in an application. I want to validate user input and inform (warn) the user of possible problems, and allow the user to 'okay' the update despite warnings.

I was curious if anyone else had already crossed this path and could offer some advice. Any help will be appreciated.

Thanks!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's a pretty broad question. So far you're just describing generic validation, which is supported by any reasonable web framework, including S2.
Robert Atchison
Greenhorn

Joined: Dec 17, 2009
Posts: 2
Validation in S2 is it's an error or it's not (as I understand it). If validation fails the user must correct some data. I need to warn the user of some business condition; something like 'acct up to date, do you really want to close acct?' Nothing wrong with data, no real errors, just something the user needs to confirm before proceeding.

Using S1 my group created a custom request processor that called custom method on the form called validateWarning(). JSP included script to throw popup with warning message (if present) for user to confirm or cancel. If user confirmed a flag to ignore warning was set and the validateWarning() method was skipped. I will need to do something similar in my S2 app.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So, do the same thing--expose an action property, and act on it in the same way. I'm not sure why a request processor would come in to play, but that's a different issue.
 
jQuery in Action, 2nd edition
 
subject: Struts 2 - implementing warning functionality
 
Similar Threads
Download a File from server to client machine - web application
Locking info: a DB field vs. in-memory
Open-Closed Principle
the most extreme that you have done or happened to you
NX: (Contractors) File I/O class