JSP의 실제 경로를 가져야하고 표현 언어을 사용해야합니다. 그런 다음 TagLib에 경로를 보냅니다.표현식 언어로 실제 경로 가져 오기
내가 찾은이 :
<mytag:getstats rtexprvalue="${pageContext.request.contextPath}"/>
하지만 그것은 가 EL에하고 다른 undefind이다 말 rtexprvalue
에 대한 경고가 있습니다 The declared exception IOException is not actually thrown by the method _elExpression15() from type __2F_PrizeWheel_2F_WebContent_2F_stats_2E_jsp
. 내 .TLD에서
내 태그 라이브러리의 선언은 다음과 같다 :
<tag>
<name>getstats</name>
<tag-class>connector.FileConnector</tag-class>
<attribute>
<name>name</name>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
어쩌면 내가 완전히 잘못 않습니다. 당신이 더 나은 솔루션이 있다면 그래서,
왜 'contextPath'를 얻으려면 속성이 필요합니까? 당신은'pageContext'를 사용하여'ServletRequest'를 얻을 수 있고 그것을'HttpServletRequest'에 던질 수 있습니다. –