extscript-examples/blog-example/src/main/webapp/WEB-INF/java/blog/Blog.java [50:92]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public String addEntry() {
        getLog().info("adding entry");
        
        /*important we have an indirection over an interface here*/
        BlogServiceInterface service = (BlogServiceInterface) resolveVariable("javaBlogService");

        if (service == null) {
            getLog().severe("service not found");
        } else {
            getLog().fine("service found");
        }

        BlogEntry entry = new BlogEntry();
        //we now map it in the verbose way, the lean way would be to do direct introspection attribute mapping

        entry.setFirstName(firstName);
        entry.setLastName(lastName);
        entry.setTopic(topic);
        
        entry.setContent(content);

        if (service != null) {
            /*convenience method to call a method on an object dynamically
            * executeMethod and cast are static imports which encapsulates the
            * ugly stuff the java introspection provides and reduce
            * the loc down to sane levels
            *
            * note the behavior in case of calling errors
            * is changed from the default managed behavior
            * to an unmanaged behavior. This is mostly
            * the same behavior you get from scripting engines!
            * 
            */

            //include for presentation 3
            //entry.setTopic(debuggingTest());
              
            service.addEntry(entry);
        }

        //we stay on the same page
        return null;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/Blog.java [50:92]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public String addEntry() {
        getLog().info("adding entry");
        
        /*important we have an indirection over an interface here*/
        BlogServiceInterface service = (BlogServiceInterface) resolveVariable("javaBlogService");

        if (service == null) {
            getLog().severe("service not found");
        } else {
            getLog().fine("service found");
        }

        BlogEntry entry = new BlogEntry();
        //we now map it in the verbose way, the lean way would be to do direct introspection attribute mapping

        entry.setFirstName(firstName);
        entry.setLastName(lastName);
        entry.setTopic(topic);
        
        entry.setContent(content);

        if (service != null) {
            /*convenience method to call a method on an object dynamically
            * executeMethod and cast are static imports which encapsulates the
            * ugly stuff the java introspection provides and reduce
            * the loc down to sane levels
            *
            * note the behavior in case of calling errors
            * is changed from the default managed behavior
            * to an unmanaged behavior. This is mostly
            * the same behavior you get from scripting engines!
            * 
            */

            //include for presentation 3
            //entry.setTopic(debuggingTest());
              
            service.addEntry(entry);
        }

        //we stay on the same page
        return null;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



