If you want to include the contents of the page on another page by adding the code on the page itself, you should compare asp with jsp and not ASP.NET MVC* with JEE - Spring MVC
So, the equivalent of <span id="logindisplay">@Html.Partial("_LogOnPartial")</span> on jsp would be one or all of the following
On your jsp, include content from another jsp using <%@ include file="../includes/inner-content.jsp" %> . This is what is called static include. The included jsp source is included and included with the parent jsp before compiling jsp. If you are using an IDE, it will verify that the included jsp does indeed take place on the specified path relative to the jsp location in which you add include. Technically, this is JSP Directive . The included jsp may just be a fragment and not addressable from the outside world (may be hidden inside WEB-INF )
You can also use the so-called dynamic include <jsp:include page="someJSP.jsp" /> . In this case, the included jsp should be addressable from the browser and should be able to render independently. When the server runs a servlet to display the parent JSP, it stops when this tag is viewed, and starts servlet execution for the included jsp, the result obtained from the internal jsp execution is then combined with the output of the parent jsp, and processing of the parent jsp resumes.
The third option is to use the Core JSTL taglib <c:import url=""/> . This works the same as option 2 above, except that it also allows you to import a page / content from a URL that lives outside of your application. Basically, you can specify a jsp path or relative URI for displaying servlets in your application or a URL to an external page.
Now I suspect that this is not what you want to do if you compare what LinkedIn does. You want to mashup content from sources in your own application and compose your page. You also want to do this in asynchronous mode so that the load verification time is checked. In this case, you need to use JavaScript and Ajax. All the mechanisms described above are intended for pages processed by the server (all HTML is created before the page is displayed in the browser). Just like @HTML . You need to create a simple structure / use the existing one, where after loading the page it launches ajax asynchronous calls to the server to receive content for certain areas on the page and displays the returned HTML in these specific areas.
Hope this helps.
Let me know if I misunderstood your question.
source share