jsp include 路径有变量怎样编写处理

jsp include 路径有变量怎样编写处理

这个在网上也是找了很多,都不管用,直到下面这个介绍:

https://blog.csdn.net/ch717828/article/details/44901347

找了老半天,这个问题终于解决。代码如下:

String day=String.valueOf(news.getS**());

String aa=(String)day.subSequence(0, 4);

request.setAttribute("h",h);

request.setAttribute("hh",hh);

out.println(aa);

out.println(news.getS**());

String add = "/**/**/" + aa+ "/"+news.getS**()+".jsp";

<jsp:include page='<%=add %>'/>

无敌!直接写成下面这样是不行的。

<jsp:include page="/**/**/" + aa+ "/"+news.getS**()+".jsp"/>

神奇!

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: