1

I am aware that Java EE 8 MVC is shiny and new and might not have everything I hoping there is a way to call a view from a controller on startup

@Path("home")
@Controller
public class HomeController {

    @Inject
    Models models;

    @Inject
    public UIAccess uiaccess;

    @GET
    @Path("index")
    public String index() {
        models.put("sidebar", uiaccess.sideBar());
        return "home/index.xhtml";
    }    
}

Is there any way that the web.xml can be setup to call the view

<welcome-file-list>
    <welcome-file>app/home/index.xhtml</welcome-file>
</welcome-file-list>

This does not work app/controller_name/view when place in the web.xml

I know servlet class can be called in startup but want about controllers.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
RWhyte
  • 13
  • 1
  • 6

1 Answers1

3

I encountered same problem before, web.xml seems doesn't support for MVC path yet.

My opinion you may select 2 option below

  1. Use JSP or html as welcome file.
  2. Use MVC as default handler and set as root context. you may learn more by sample.
Vy Do
  • 46,709
  • 59
  • 215
  • 313