0

I am fighting with ActiveWeb currently. I found, as it seems to me, that it's manual here http://javalite.io/activeweb contains a lot of desinformation.

First it says ActiveWeb is zer-configuration, which is not true. web.xml is still required. Also configuration in java is required. For example, file AppBootstrap.java should be present in appropriate location.

Second, I can't find it yet, how to configure views to work.

I have the following controller

package app.controllers;

import java.util.Date;

import org.javalite.activeweb.AppController;

public class GreetingController extends AppController {
    public void index() {

    }

    public void hello() {
        view("date", new Date().toString());
        view("name", param("name"));

    }
}

and it works as I see in debugger. When I open http://localhost:8080/testapp/greeting/hello, the breakpoint in hello() method is reached.

Unfortunately, the file hello.ftl, located in WEB-INF/views/greeting/hello.ftl is apparently ignored, because the browser output is empty.

Simultaneously, it is 100% empty, i.e. there are no HTTP headers at all. This points to suggestion, that some general config is missing.

Also, I have empty output on EVER query, including

http://localhost:8080/testapp

http://localhost:8080/testapp/greeting

http://localhost:8080/testapp/abracadabra

while some of the requests should return errors or service messages.

Request

http://localhost:8080/

returns 404 which means container is working normally.

My web.xml is follows:

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
    <display-name>Archetype Created Web Application</display-name>

    <filter>
        <filter-name>dispatcher</filter-name>
        <filter-class>org.javalite.activeweb.RequestDispatcher</filter-class>
        <init-param>
            <param-name>exclusions</param-name>
            <param-value>css,images,js</param-value>
        </init-param>
        <init-param>
            <param-name>root_controller</param-name>
            <param-value>home</param-value>
        </init-param>
    </filter>


    <filter-mapping>
        <filter-name>dispatcher</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>

UPDATE

When I removed root_controller parameter from web.xml, the server started to answer with directory listing on

http://localhost:8080/testapp

Other answers are still completely empty

UPDATE 2

Apparently WEB-INF/views/layouts/default_layout.ftl should be present. Otherwise the results will be empty and no error will be reported.

Dims
  • 47,675
  • 117
  • 331
  • 600

1 Answers1

0

something is definitely mis-configured in your app. Can you post sources somewhere on Github? You can also clone this app: https://github.com/javalite/activeweb-bootstrap

ipolevoy
  • 5,432
  • 2
  • 31
  • 46
  • Also, the page you are referring to is simply explanation of how the framework works. Please refer to this page: http://javalite.io/getting_started_activeweb as a Getting Started guide. – ipolevoy Sep 12 '14 at 04:25
  • `activeweb-bootstrap` application just does not compile. try it yourself: http://stackoverflow.com/questions/25790336/a-required-class-was-missing-while-executing-org-mortbay-jettymaven-jetty-plugi – Dims Sep 12 '14 at 10:28
  • that was not a compilation problem, but rather some Maven issue I could not reproduce. Please, see my comment: http://stackoverflow.com/questions/25790336/a-required-class-was-missing-while-executing-org-mortbay-jettymaven-jetty-plugi – ipolevoy Sep 13 '14 at 22:04