This is a common confusion. A URL path is not a file path. but it is often resolved to a file path. Plus Unix file path and URL notations are similar.
But also you are confusing the resource with the resource locator
The resource locator (Uniform Resource Locator == URL) tells the server that it wants a specified resource. So it's actually more of an address. The webserver then uses rules built into it to route the URL request to a specific webapp (context), and the webapp then further parses the URL to determine what resource resolution mechanism to pass it to.
Here's what actually happens when you submit the URL http://localhost:8080/mywebapp/login/main/welcome.jsf
. I've changed your URL to make some features more obvious.
First, the client parses the URL. It determines that it should use the HTTP protocol to formulate the request to the server. It looks up the servername "localhost", and resolves it to it IP address 127.0.0.1.
Then it opens a connection to IP 127.0.0.1 port 8080 and send the URL request.
On the server, the incoming URL request is received by Tomcat (which is listening on port 8080). Tomcat parses the URL and detects that the web application context path is "/mywebapp" (I changed this to make things more obvious). Tomcat extracts request context information, sets up response infrastructure and does other support things and then sends the URL request to mywebapp. To be precise, Tomcat looks in mywebapp's servlet map to see if there's a servlet that matches the URL pattern "*.jsf". Notice I made another change to your URL here to make things clearer.
Tomcat determines that URLs that end with ".jsf" should be routed to the FacesServlet. So it does so. The FacesServlet received the URL request /login/main/welcome.jsf. The Facelets processor that's part of the JSF version 2 FacesServlet converts the URL extension ".jsf" to the resource extension ".xhtml". This is the default behaviour, although overrides can be configured. So the converted (internal) resource path beomes "/login/main/welcome.xhtml". The FacesServlet then retrieves this resource from the WAR using the convention that /login/main/ are WAR-relative directory names and "welcome.xhtml" is a "file" name. Since a WAR is officially a ZIP file, these are only actual files and directories if Tomcat unzips (explodes) the WAR when it deploys it (by default it does, but the location mechanism works either way). Now that we have located welcome.xhtml, the FacesServlet digests it and build a JSF component tree, which holds incoming data and is used to manage the Controllers and Listeners (and other things) that go into processing a JSF request, finally being used by the JSF Render Response phase to generate the actual HTML response that gets sent back to the client.
So in short, by convention a web page in /dir1/dir2/.../xxxx.jsf should have a JSF View Template (xhtml) "file" at /dir1/dir2/.../xxxx.xhtml and in that sense, the directories do match.