When we are programming jsps, we sometimes need to access the data in the Jstl, or the data in the El expression.
Like what
<c:foreach varstatus= "data1" var= "Data" items= "${alltemphotmeltdata}";
<tr>
<td>
${data.hno}
</td>
<td>
${data.hdate}
</td>
<td>
${data.hhour}
</td>
Span style= "White-space:pre" > <td>
${data.hend}
</td>
<td>
${data.hoperat}
</td>
</tr>
</c:foreach >
In the preceding code snippet, you can do this if you want to get the value in the El expression for processing:
<td>
<%
String hgps_latitude= ((hotmeltdata)Pagecontext.getattribute ("Data")).Gethgps_latitude (). toString (). Replace (".", ""). Replace ("degrees", "."). Replace ("Min", "" ");
String hgps_longitude= ((hotmeltdata)Pagecontext.getattribute ("Data")). Gethgps_longitude (). toString (). Replace (".", ""). Replace ("degrees", "."). Replace ("Min", "" ");
Float latitude=float.parsefloat (hgps_latitude.substring (0, 2)) +float.parsefloat (hgps_latitude.substring (2, HGPS_ Latitude.length ()))/60;
Float longitude=float.parsefloat (hgps_longitude.substring (0, 3)) +float.parsefloat (Hgps_longitude.substring (3, Hgps_longitude.length ()))/60;
%>
<a href= "http://api.map.baidu.com/marker?location=<%=latitude%>,<%=longitude%>&title= Positioning & content= Baidu &output=html "target=" _blank "> Map positioning </a>
</td>
The red part of the above is the data in El can be obtained.
As mentioned above, you can use
Pagecontext.getattribute ()
Request.getattribute ()
Session.getattribute ()
Application.getattribute ()
Get the value.
Another example:
<c:set var= "A" value= "Hello a" scope= "request"/>
<c:set var= "B" value= "Hello B"/>
<%
Out.print (Request.getattribute ("a") + "<br/>");
Out.print (Pagecontext.getattribute ("B"));
%>
In the same vein, you can get variables from the JSP into the JSTL variable.