top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

VisitorFieldValidation with annotations at action level in Javabean

+1 vote

I have an action with a getter/setter of a bean :

public class MyAction extends ActionSupport implements Preparable {
 private BeanEvent event = null;
 public void prepare() {
 this.event = new BeanEvent();
 public BeanEvent getEvent() {
 return this.event;
 public void setEvent(BeanEvent e) {
 this.event = e;

The bean is a standard Java bean with getters and setters for some properties. I would like to validate the bean using annotations at MyAction level, so no annotations would be needed in the BeanEvent. I understand that the VisitorFieldValidation allows to use validation for beans, but only when definining the actual validation in the bean. Is there any way I could define the validation at the Action level?

posted May 28, 2013 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

Similar Questions
0 votes

We have a websocket application which keeps writing data to the clients.

We found that when tabs (not whole browser) of Firefox (ver. 22) is closed, the websocket connection is not closed. Anyway, reproducibility is very low. And the sendQ (netstat -an) keeps growing

So, what we did is. we kept sending heart beat from client. If this heart beat timeout occurs, we are trying to close the connection as follows

ByteBuffer bbuff = ByteBuffer.allocate(1);
bbuff.put((byte) 0);
messageInbound.getWsOutbound().close(0, bbuff);

Is this correct approach to close the connection from server? Because, the connection is not closed at lower level (netstat -an). Anyway, writing data to it , is stopped and sendQ stops growing.

# netstat -an | grep :8080
tcp 0 402376 ESTABLISHED
0 votes

I have some doubt about how to use validation annotation. I'm changing my code to make it more readable and maintainable.

I started from an action where I had all setters with annotation and i put data in a private local variable

private String email;

@RequiredStringValidator(key="fieldError.required", message = "*")
 @EmailValidator (key="fieldError.emailFormat", message="*")
public void setEmail(String email) { = email;

It functioned well but I neeed to reorganize my code. So, I create e class User where I directly put data coming from the web and I erase all the private variable in this way

User user = null;
 public User getUser() {
if (user == null)
user = new User();
 return user;

@RequiredStringValidator(key="fieldError.required", message = "*")
 @EmailValidator (key="fieldError.emailFormat", message="*")
public void setEmail(String email) {

My bean receives data but validators stop to function, so I receive bad validation messages. Does validator need a getter (not present also in the first release) or use reflection on local variables to check data? How can I implement my new data model in Struts2

0 votes

In LTE we use headers in one side and followed by data PDU,but why there is a change in 5G . like after every single header there is a PDU and so on?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.