We have a variable in jsp:

${time} 

how can i get it in jsp script

 <% String t = ${time}; <- вот тут %> 

Tell me. Thank.

    2 answers 2

    Did so

    assigned the value of the time variable in the JSP

      <c:set var="time" value='2016.08.10 00:00:00'/> <% // запросили значение String date_input =(pageContext.getAttribute("time", PageContext.PAGE_SCOPE)).toString(); // подготовка формата даты SimpleDateFormat format_data = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); DateFormat format = format_data; Date date = format.parse(time); format_data.applyPattern("dd.MM.yyyy HH:mm:ss"); date_input=format.format(date); %> 
    • PPC is not relevant for how long)) - Jenkamen

    Are you sure that you really NEED a scriptlet? You definitely can not prepare the data in the bin or before transferring control to the JSP? If it is not exactly 100,500%, then you can get through one of the contexts (depending on where this variable comes from). This will be either the pageContext, or the session, or the application context or the request context, which are available either directly or through the servlet context.

    • Hm Where does spring place all the variables?) - Jenkamen
    • one
      I can not say, I am not a sprint specialist. But I think you should think about the concept. The need for a scriptlet on a JSP almost certainly indicates a design error. - cy6erGn0m