JSTL - pegar conteudo do Pathname

1 resposta
R

Pessoal como eu faço para pegar o path dentro do if?
Fiz dessa form mas não deu certo?

<c:set var="site" value="document.location.pathname"/>
	

		<c:if test="${fn:contains(site, 'tivit')}">
		   <p>Found test string</p>
		</c:if>
		
		<c:if test="${fn:contains(site, 'caixa')}">
		   <p>Found TEST string</p>
		</c:if>

Alguem poderia me dar uma orientação ? Obrigado

1 Resposta

surfzera

Tenta assim:

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    request.setAttribute("basePath", basePath);
%>

    <c:set var="site" value="<%=basePath%>"/>  
         
            <c:if test="${fn:contains(site, 'tivit')}">  
               <p>Found test string</p>  
            </c:if>  
              
            <c:if test="${fn:contains(site, 'caixa')}">  
               <p>Found TEST string</p>  
            </c:if>
Criado 13 de setembro de 2012
Ultima resposta 13 de set. de 2012
Respostas 1
Participantes 2