jsp - Ajax call return html content using apache tiles -


i want html content when ajax call using apache tiles, code below, ajax function

$.ajax({     url : '/home',     datatype : 'html',     success : function(data) {          console.log(data);     } }); 

java file

@requestmapping(value="/home", method=requestmethod.get) public @responsebody string gethomepage(httpservletrequest request, httpservletresponse response, modelmap model) {      model.addattribute("name", "demo");     return "home"; } 

jsp page(home.jsp)

<html> <head></head> <body>${name}</body> </html> 

empty template file(emptytemplate.jsp)

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tile" %> <tile:insertattribute name="body" /> 

apache files

<definition name="home" extends="emptytemplate">     <put-attribute name="body" value="/web-inf/home.jsp" />   </definition> <definition name="emptytemplate" template="/web-inf/templates/emptytemplate.jsp">     <put-attribute name="body"  /> </definition> 

when call "home" url ajax can return "home", "home" 1 of definition of apache files, first find in apache files. gets "home" definition apache file can return "home.jsp" file.

so question ajax response "home" want home page html content instead of "home" string.

so how can it's possible?


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -