Mentawai Web Framework

Debug Mode

Wouldn't be good if you could see everything that happens behing the scene inside the framework? Which action is being executed, what filters are being applied, how does the action input/output looks like after every step? Mentawai will reveal its magic through its debug mode.

The Debug Mode will display at the bottom of every JSP page the details behind the action execution. You can also configure it to show this information as a HTML comment, if you prefer.

To see the Debug Mode in action, play a little bit with the mybooks demo application.

To turn on the Debug Mode in your application, you should do:

import org.mentawai.core.*;
import org.mentawai.filter.*;

public class ApplicationManager extends org.mentawai.core.ApplicationManager {
	
    public void loadActions() {
        
        setDebugMode(true);
        //or
        //setDebugMode(true, true); // the second boolean here is to show the info in a HTML comment

        ActionConfig ac = new ActionConfig("/Hello", HelloVOFilter.class);
        ac.addConsequence(SUCCESS, fwd("/show.jsp"));
        ac.addConsequence(ERROR, fwd("/user.jsp"));
        addActionConfig(ac);
        
    }
}

					

And you also have to turn on the org.mentawai.util.DebugServletFilter which is a servlet filter, not a mentawai filter.

To turn on the filter you place the following lines inside your web.xml file:

    <filter>
        <filter-name>DebugFilter</filter-name>
        <filter-class>
            org.mentawai.util.DebugServletFilter
        </filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>DebugFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
        <dispatcher>REQUEST</dispatcher> 
        <dispatcher>FORWARD</dispatcher>    
        <dispatcher>INCLUDE</dispatcher>    
        <dispatcher>ERROR</dispatcher>    
    </filter-mapping>