2016-01-22 4 views
0

я следующую строку кода в файл JSP в моем веб-приложение тошибка в файле Jsp

<% if (!maintenance) { %> 
<customTag:DialogEntry entry="<%=new com.presentation.generic.session.DialogEntry("dialog1","225px","true","true",new String[]{"authentification.Login.action.logInApplicationLabel"},new String[]{"logInApplication()"}) %>"/> 
<% } else { %> 
<customTag:DialogEntry entry="<%=new com.presentation.generic.session.DialogEntry("dialog1","225px","true","true",new String[]{},new String[]{}) %>"/> 
<% } %> 

сообщение об ошибке, что я получаю:

/WEB- INF/теги/DialogEntry.tag Согласно TLD, значение атрибута не принимает никакого выражения

Как решить эту проблему?

DialogEntry.tag:

<%@ attribute name="entry" rtexprvalue="true" type="com.presentation.generic.session.DialogEntry" %> 

<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> 
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %> 
<%@ taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean" %> 
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> 
<%@ taglib uri="http://struts.apache.org/tags-logic-el" prefix="logic" %> 




    <script type="text/javascript"> 

    //confirm("<c:out value="${entry.id}" /> début"); 

    var <c:out value="${entry.id}" /> = new YAHOO.widget.Dialog("<c:out value="${entry.id}" />", 
      { 
     width: "<c:out value="${entry.size}" />", 
     <c:if test="${\"\" != entry.visible}"> 
      visible:true, 
     </c:if> 
     <c:if test="${\"\" == entry.visible}"> 
      visible:false, 
     </c:if> 


     close:false, 
     draggable :false 
     <c:if test="${\"\" != entry.effect}"> 
      ,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5} 
         }); 
     </c:if> 
     <c:if test="${\"\" == entry.effect}"> 
      }); 
     </c:if> 

     <c:if test="${\"false\" != entry.hasButtons}"> 

      var myButtons = [ 
      <c:forEach var="button" items="${entry.buttons}" varStatus="ind"> 
        { text:"<bean:message key="${button}"/>", handler:function() {<c:out value="${entry.functions[ind.index]}" />;}, isDefault:true } 
        <c:if test="${!empty entry.buttons[ind.index+1]}"> 
         , 
        </c:if> 
      </c:forEach> 
      ]; 

      <c:out value="${entry.id}" />.cfg.queueProperty("buttons", myButtons); 
     </c:if> 

    // confirm("<c:out value="${entry.id}" /> fin - debut script"); 

    if($.browser.msie && $('#header').size() > 0){ 

     // confirm("<c:out value="${entry.id}" /> fin - debut script IE"); 
     var menuWidth = $("div#menu").get(0).clientWidth; 

     var headerHeight = $("div#header").get(0).clientHeight; 

     var width = document.body.clientWidth; 
     var contentWidthConnected = width - menuWidth; 

     if($('div#content_onglets').size() > 0){ 
      // confirm("<c:out value="${entry.id}" /> fin - debut script IE Onglet"); 
      <c:out value="${entry.id}" />.cfg.queueProperty("x", 50); 
      <c:out value="${entry.id}" />.cfg.queueProperty("y", 0); 

     } 
     else{ 
      // confirm("<c:out value="${entry.id}" /> fin - debut script IE Pas Onglet"); 
      <c:out value="${entry.id}" />.cfg.queueProperty("x", menuWidth + 50); 
      <c:out value="${entry.id}" />.cfg.queueProperty("y", headerHeight); 
     } 

     // confirm("<c:out value="${entry.id}" /> fin - FIN script IE"); 

    } 
    else{ 
     <c:out value="${entry.id}" />.cfg.queueProperty("fixedcenter", true); 
    }  

    // confirm("<c:out value="${entry.id}" /> fin script"); 

    <c:out value="${entry.id}" />.render(); 



    // confirm("<c:out value="${entry.id}" /> fin script 2"); 
    </script> 
+0

@ Сатья, извините, я не понимаю – Mercer

+1

вместо использования двойных кавычек снаружи попробуйте одинарные кавычки. – Satya

+0

Вы полностью изменили вопрос. Вы должны были принять один из ответов, которые решили заданный вами вопрос, и открыли новую для вашей новой проблемы. –

ответ

2

Либо бежать ваши внутренние цитаты:

<% if (!maintenance) { %> 
    <customTag:DialogEntry entry="<%=new com.presentation.generic.session.DialogEntry(\"dialog1\",\"225px\",\"true\",\"true\",new String[]{\"authentification.Login.action.logInApplicationLabel\"},new String[]{\"logInApplication()\"}) %>"/> 
<% } else { %> 
    <customTag:DialogEntry entry="<%=new com.presentation.generic.session.DialogEntry(\"dialog1\",\"225px\",\"true\",\"true\",new String[]{},new String[]{}) %>"/> 
<% } %> 

Или использовать одиночные кавычки:

<% if (!maintenance) { %> 
    <customTag:DialogEntry entry='<%=new com.presentation.generic.session.DialogEntry("dialog1","225px","true","true",new String[]{"authentification.Login.action.logInApplicationLabel"},new String[]{"logInApplication()"}) %>'/> 
<% } else { %> 
    <customTag:DialogEntry entry='<%=new com.presentation.generic.session.DialogEntry("dialog1","225px","true","true",new String[]{},new String[]{}) %>'/> 
<% } %> 

Считывая сообщение об ошибке is quoted with " which must be escaped when used within the value, вы видите, что в вашем тексте есть ". Следовательно, либо ваш текст не определен с помощью " (второе решение, в котором вы используете '), либо " внутри текста имеет \, чтобы избежать их и сделать их действительными символами в тексте.

+0

, когда я делаю ваше решение, у меня есть это сообщение '/WEB-INF/tags/DialogEntry.tag В соответствии с TLD атрибут value не принимает выражения.' – Mercer

+1

Это еще одна проблема в вашем коде, о которой я понятия не имею , Может быть, открыть новый вопрос или изменить его? – BlueMoon93

+0

Я добавляю свой источник 'DialogEntry.tag' – Mercer

1

избежать всех "с \" внутри блока:

entry="" 
+0

Согласно этому исключению, вы пропустили какую-то цитату. – eg04lt3r

Смежные вопросы