Using El expressions to pass by value

1. Direct value transfer

        Use request.setAttribute("",""); (note: we can only pass the parameter value directly, not to the redirect page)

 

2. Redirect pass value

redirectAttributes.addFlashAttribute("","");

 You can pass the value to the redirected page, but you can only pass the value to the redirected page once (this sentence is my own feeling, if I am wrong, you must remind me)

 

3. Model storage value

      In the ssm framework, when the jsp page uses the EL expression, the Model should be used to store the value, for example:

jsp page
<h4><p>作者:${blog.uname}</p> <p>标签:${blog.blable}</p></h4><br>
<br><br>
<div style="width: 70%; float: left" >
<pre width="40">${blog.bcontext}</pre>
In the controller:
model.addAttribute("blog",blog);

 The blog in the jsp page corresponds to the archived blog of the model

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326422867&siteId=291194637