How to access Spring MVC model object in javascript file?

前端 未结 8 1135
南方客
南方客 2020-12-28 19:05

I am using spring 3 MVC and i have below classes.

External system would call my application using below URL:

http://somehost/root/param1/param2/param         


        
8条回答
  •  失恋的感觉
    2020-12-28 19:13

    JavaScript is run on the client side. Your model does not exist on the client side, it only exists on the server side while you are rendering your .jsp.

    If you want data from the model to be available to client side code (ie. javascript), you will need to store it somewhere in the rendered page. For example, you can use your Jsp to write JavaScript assigning your model to JavaScript variables.

    Update:

    A simple example

    <%-- SomeJsp.jsp --%>
    
    

提交回复
热议问题