This is my Index.html
file
<!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8"><title>Greeting Page</title></head><body>Hello Home Page !!<br><a href="result?data=500">Send data to server</a></body></html>
Here is another html file with name result.html
<!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8"><title>Title</title></head><body><br>Your output is: <span th:text="${value}"></span></body></html>
This is my simple controller class with name First.java
package com.progrank.maven.MavenApp.Class;import ch.qos.logback.core.model.Model;import jakarta.servlet.http.HttpServlet;import jakarta.servlet.http.HttpServletRequest;import jakarta.servlet.http.HttpSession;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@Controllerpublic class First { @RequestMapping("/index") public String hello(){ return "index"; } @RequestMapping("/result") public String index(String data,HttpSession session){ System.out.println("Data:"+data); session.setAttribute("value:",data); return "result"; }}
In that after click on that link I am getting exception like
Send data to server of that then they are redirect yo result page and data is alredy featching but they can not show in webpage they are showing a output is this :Your output is:${value}
Expexted Output is this :Your output is:500