Logo F2FInterview

Struts Interview Questions

Q   |   QA

If the namespace attribute is not defined in the package tag or assigned “” value then it is called empty default namespace.While if “/” is assigned as value to the namespace attribute then it is called as root namespace. The root namespace is treated as all other explicit namespaces and must be matched. It’s important to distinguish between the empty default namespace, which can catch all request patterns as long as the action name matches, and the root namespace, which is an actual namespace that must be matched.

com.opensymphony.xwork2.interceptor.ParametersInterceptor is the interceptor class who sets the action’s JavaBean properties from request.

Action is interface defines some string like SUCCESS,ERRORetc and an execute() method. For convenience Developer implement this interface to have access to String field in action methods. ActionSupport on other hand implements Action and some other interfaces and provides some feature like data validation and localized error messaging when extended in the action classes by developers.

Here is the intercept method

public String intercept(ActionInvocation invoke) throws Exception {
ActionContext action=invoke.getInvocationContext();
HttpServletRequestreq=(HttpServletRequest)action.get(StrutsStatics.HTTP_REQUEST);
return null;
}

The ExecuteAndWaitInterceptor is great interceptor provided out of box in Struts2 for running long-lived actions in the background while showing the user a nice progress meter or a progress bar. For example while uploading a large file to the server we can use this interceptor to display a nice running progress bar instead of leaving the user in confusion that the application is not responding.This also prevents the HTTP request from timing out when the action takes more than 5 or 10 minutes.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: