2

変数がef1、efabc、efanythinkのようにキー「ef」で始まるかどうかを確認する必要があります...そして、はいの場合、エラーメッセージを表示します。ここでphpとjspの混合を過ぎました。もちろん正しくなく、エラーがあります。jspを理解していません:

<c:if test="${empty channel.getChannelName()}">
<%
if (string_starts_with(${channelName}, 'ef')) { header("location:http://google.com"); }

または、このエラーの div を表示します

<div class="error"> This Channel url Portected!</div>

元のファイル: http://pastebin.com/ach8PXY9

4

3 に答える 3

2

そのための JSTL メソッドがあります。

<c:choose>
    <c:when test="${fn:startsWith(channel.getChannelName(), "ef")}">
        <script type="text/javascript">window.location.replace("http://google.com/");</script></c:when>
    <c:otherwise>
        <div class="error"> This Channel url Portected!</div>
    </c:otherwise>
</c:choose>

http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fn/tld-summary.html

于 2013-12-10T23:00:21.917 に答える