kinman      2002/06/12 15:08:29

  Modified:    jasper2/src/share/org/apache/jasper/compiler Generator.java
  Log:
  - If the page attribute for jsp:include or jsp:forward contains a '?',
    then the separator after the page should be '&' instead of '?'.
  
  Revision  Changes    Path
  1.27      +24 -11    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Generator.java    12 Jun 2002 20:19:32 -0000      1.26
  +++ Generator.java    12 Jun 2002 22:08:28 -0000      1.27
  @@ -507,26 +507,39 @@
         *
         * @param n the parent node for the param action nodes.
         */
  -     private void printParams(Node n) throws JasperException {
  +     private void printParams(Node n, Node.JspAttribute page)
  +                                             throws JasperException {
   
            class ParamVisitor extends Node.Visitor {
  -             char separator = '?';
  +             String separator;
  +
  +             ParamVisitor(String separator){
  +                 this.separator = separator;
  +             }
   
                public void visit(Node.ParamAction n) throws JasperException {
   
  -                 out.print(" + \"");
  +                 out.print(" + ");
                    out.print(separator);
  +                 out.print(" + \"");
                    out.print(n.getAttributeValue("name"));
                    out.print("=\" + ");
                    out.print(attributeValue(n.getValue(), true));
   
                    // The separator is '&' after the second use
  -                 separator = '&';
  +                 separator = "\"&\"";
                }
            }
   
  +         String pValue = page.getValue();
  +         String sep;
  +         if (page.isExpression()) {
  +             sep = "((" + pValue + ").indexOf('?')>0? '&': '?')";
  +         } else {
  +             sep = pValue.indexOf('?')>0? "\"&\"": "\"?\"";
  +         }
            if (n.getBody() != null) {
  -             n.getBody().visit(new ParamVisitor());
  +             n.getBody().visit(new ParamVisitor(sep));
            }
        }
   
  @@ -554,7 +567,7 @@
   
            out.printin("JspRuntimeLibrary.include(request, response, ");
            out.print(attributeValue(n.getPage(), false));
  -         printParams(n);
  +         printParams(n, n.getPage());
            out.println(", out, " + isFlush + ");");
   
            n.setEndJavaLine(out.getJavaLine());
  @@ -568,8 +581,8 @@
            out.printil("if (true) {"); // So that javac won't complain about
            out.pushIndent();           // codes after "return"
            out.printin("pageContext.forward(");
  -         out.print  (attributeValue(n.getPage(), false));
  -         printParams(n);
  +         out.print(attributeValue(n.getPage(), false));
  +         printParams(n, n.getPage());
            out.println(");");
            out.printil((methodNesting > 0)? "return true;": "return;");
            out.popIndent();
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to