How to accept the value passed from the java background in the html page_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:14:52
Original
2365 people have browsed it

java background session.setAttribute("dh",t); or request.setAttribute();
How to get it in the html page? If it is a jsp page: <%=session.getAttribute("dh") %>
But you cannot use jsp pages, you can only use html. Can JS be used? How can I get it?


Reply to discussion (solution)

Since it is a java background, it can only be obtained with jsp

If I convert the value of the background into json
JSONArray json = new JSONArray().fromObject(t);
PrintWriter outpw = response.getWriter();
String jsonto = json.toString();
outpw.write(jsonto);
How can I get it from the front-end html? Without strust2
js, how can I get the back-end json

Can I get it from JS?

You can use ajax to get it

Baidu

Refer to the example

$.ajax How to implement it specifically? Please post it. I tried it several times and got it. Not worth it

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template