How to display a variable value in JSP file

烈酒焚心 提交于 2019-12-05 07:24:37
San Krish

To display the server side variables in jsp , you can use implicit object out.

some thing like this,

<div class="marginTable"  data-count="5">
  <%=id%>
</div>

But using scriptlets is considered as the bad practice . so you may use EL for more info see this How to avoid Java code in JSP files? as,

${id}

I think this what you are looking for.....

page1.html...

 <a href="page2.jsp?id=5">Go</a>

page2.html

    <% String id = request.getParameter("id"); %>
    <div class="marginTable" data-pubid="<%=id%>" data-count="5"></div>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!