Lines 167-192
Link Here
|
167 |
return b.toString(); |
167 |
return b.toString(); |
168 |
} |
168 |
} |
169 |
|
169 |
|
170 |
/** |
|
|
171 |
* Finds the <jsp:body> subelement of the given parent node. If not |
172 |
* found, null is returned. |
173 |
*/ |
174 |
protected static Node.JspBody findJspBody(Node parent) { |
175 |
Node.JspBody result = null; |
176 |
|
177 |
Node.Nodes subelements = parent.getBody(); |
178 |
for (int i = 0; (subelements != null) && (i < subelements.size()); i++) { |
179 |
Node n = subelements.getNode(i); |
180 |
if (n instanceof Node.JspBody) { |
181 |
result = (Node.JspBody) n; |
182 |
break; |
183 |
} |
184 |
} |
185 |
|
186 |
return result; |
187 |
} |
188 |
|
189 |
|
190 |
private String createJspId() { |
170 |
private String createJspId() { |
191 |
if (this.jspIdPrefix == null) { |
171 |
if (this.jspIdPrefix == null) { |
192 |
StringBuilder sb = new StringBuilder(32); |
172 |
StringBuilder sb = new StringBuilder(32); |
Lines 358-363
Link Here
|
358 |
|
338 |
|
359 |
@Override |
339 |
@Override |
360 |
public void visit(Node.CustomTag n) throws JasperException { |
340 |
public void visit(Node.CustomTag n) throws JasperException { |
|
|
341 |
// XXX - Actually there is no need to declare those |
342 |
// "_jspx_" + varName + "_" + nestingLevel variables when we are |
343 |
// inside a JspFragment. |
361 |
|
344 |
|
362 |
if (n.getCustomNestingLevel() > 0) { |
345 |
if (n.getCustomNestingLevel() > 0) { |
363 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
346 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
Lines 991-996
Link Here
|
991 |
} |
974 |
} |
992 |
} |
975 |
} |
993 |
|
976 |
|
|
|
977 |
/** |
978 |
* Finds the <jsp:body> subelement of the given parent node. If not |
979 |
* found, null is returned. |
980 |
*/ |
981 |
private Node.JspBody findJspBody(Node parent) { |
982 |
Node.JspBody result = null; |
983 |
|
984 |
Node.Nodes subelements = parent.getBody(); |
985 |
for (int i = 0; (subelements != null) && (i < subelements.size()); i++) { |
986 |
Node n = subelements.getNode(i); |
987 |
if (n instanceof Node.JspBody) { |
988 |
result = (Node.JspBody) n; |
989 |
break; |
990 |
} |
991 |
} |
992 |
|
993 |
return result; |
994 |
} |
995 |
|
994 |
@Override |
996 |
@Override |
995 |
public void visit(Node.ForwardAction n) throws JasperException { |
997 |
public void visit(Node.ForwardAction n) throws JasperException { |
996 |
Node.JspAttribute page = n.getPage(); |
998 |
Node.JspAttribute page = n.getPage(); |
Lines 2505-2515
Link Here
|
2505 |
} |
2507 |
} |
2506 |
|
2508 |
|
2507 |
private void declareScriptingVars(Node.CustomTag n, int scope) { |
2509 |
private void declareScriptingVars(Node.CustomTag n, int scope) { |
|
|
2510 |
if (isFragment) { |
2511 |
// No need to declare Java variables, if we inside a |
2512 |
// JspFragment, because a fragment is always scriptless. |
2513 |
return; |
2514 |
} |
2508 |
|
2515 |
|
2509 |
Vector<Object> vec = n.getScriptingVars(scope); |
2516 |
List<Object> vec = n.getScriptingVars(scope); |
2510 |
if (vec != null) { |
2517 |
if (vec != null) { |
2511 |
for (int i = 0; i < vec.size(); i++) { |
2518 |
for (int i = 0; i < vec.size(); i++) { |
2512 |
Object elem = vec.elementAt(i); |
2519 |
Object elem = vec.get(i); |
2513 |
if (elem instanceof VariableInfo) { |
2520 |
if (elem instanceof VariableInfo) { |
2514 |
VariableInfo varInfo = (VariableInfo) elem; |
2521 |
VariableInfo varInfo = (VariableInfo) elem; |
2515 |
if (varInfo.getDeclare()) { |
2522 |
if (varInfo.getDeclare()) { |
Lines 2552-2557
Link Here
|
2552 |
if (n.getCustomNestingLevel() == 0) { |
2559 |
if (n.getCustomNestingLevel() == 0) { |
2553 |
return; |
2560 |
return; |
2554 |
} |
2561 |
} |
|
|
2562 |
if (isFragment) { |
2563 |
// No need to declare Java variables, if we inside a |
2564 |
// JspFragment, because a fragment is always scriptless. |
2565 |
// Thus, there is no need to save/ restore/ sync them. |
2566 |
// Note, that JspContextWrapper.syncFoo() methods will take |
2567 |
// care of saving/ restoring/ sync'ing of JspContext attributes. |
2568 |
return; |
2569 |
} |
2555 |
|
2570 |
|
2556 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
2571 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
2557 |
VariableInfo[] varInfos = n.getVariableInfos(); |
2572 |
VariableInfo[] varInfos = n.getVariableInfos(); |
Lines 2559-2571
Link Here
|
2559 |
return; |
2574 |
return; |
2560 |
} |
2575 |
} |
2561 |
|
2576 |
|
|
|
2577 |
List<Object> declaredVariables = n.getScriptingVars(scope); |
2578 |
|
2562 |
if (varInfos.length > 0) { |
2579 |
if (varInfos.length > 0) { |
2563 |
for (int i = 0; i < varInfos.length; i++) { |
2580 |
for (int i = 0; i < varInfos.length; i++) { |
2564 |
if (varInfos[i].getScope() != scope) |
2581 |
if (varInfos[i].getScope() != scope) |
2565 |
continue; |
2582 |
continue; |
2566 |
// If the scripting variable has been declared, skip codes |
2583 |
// If the scripting variable has been declared, skip codes |
2567 |
// for saving and restoring it. |
2584 |
// for saving and restoring it. |
2568 |
if (n.getScriptingVars(scope).contains(varInfos[i])) |
2585 |
if (declaredVariables.contains(varInfos[i])) |
2569 |
continue; |
2586 |
continue; |
2570 |
String varName = varInfos[i].getVarName(); |
2587 |
String varName = varInfos[i].getVarName(); |
2571 |
String tmpVarName = "_jspx_" + varName + "_" |
2588 |
String tmpVarName = "_jspx_" + varName + "_" |
Lines 2581-2587
Link Here
|
2581 |
continue; |
2598 |
continue; |
2582 |
// If the scripting variable has been declared, skip codes |
2599 |
// If the scripting variable has been declared, skip codes |
2583 |
// for saving and restoring it. |
2600 |
// for saving and restoring it. |
2584 |
if (n.getScriptingVars(scope).contains(tagVarInfos[i])) |
2601 |
if (declaredVariables.contains(tagVarInfos[i])) |
2585 |
continue; |
2602 |
continue; |
2586 |
String varName = tagVarInfos[i].getNameGiven(); |
2603 |
String varName = tagVarInfos[i].getNameGiven(); |
2587 |
if (varName == null) { |
2604 |
if (varName == null) { |
Lines 2612-2617
Link Here
|
2612 |
if (n.getCustomNestingLevel() == 0) { |
2629 |
if (n.getCustomNestingLevel() == 0) { |
2613 |
return; |
2630 |
return; |
2614 |
} |
2631 |
} |
|
|
2632 |
if (isFragment) { |
2633 |
// No need to declare Java variables, if we inside a |
2634 |
// JspFragment, because a fragment is always scriptless. |
2635 |
// Thus, there is no need to save/ restore/ sync them. |
2636 |
// Note, that JspContextWrapper.syncFoo() methods will take |
2637 |
// care of saving/ restoring/ sync'ing of JspContext attributes. |
2638 |
return; |
2639 |
} |
2615 |
|
2640 |
|
2616 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
2641 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
2617 |
VariableInfo[] varInfos = n.getVariableInfos(); |
2642 |
VariableInfo[] varInfos = n.getVariableInfos(); |
Lines 2619-2631
Link Here
|
2619 |
return; |
2644 |
return; |
2620 |
} |
2645 |
} |
2621 |
|
2646 |
|
|
|
2647 |
List<Object> declaredVariables = n.getScriptingVars(scope); |
2648 |
|
2622 |
if (varInfos.length > 0) { |
2649 |
if (varInfos.length > 0) { |
2623 |
for (int i = 0; i < varInfos.length; i++) { |
2650 |
for (int i = 0; i < varInfos.length; i++) { |
2624 |
if (varInfos[i].getScope() != scope) |
2651 |
if (varInfos[i].getScope() != scope) |
2625 |
continue; |
2652 |
continue; |
2626 |
// If the scripting variable has been declared, skip codes |
2653 |
// If the scripting variable has been declared, skip codes |
2627 |
// for saving and restoring it. |
2654 |
// for saving and restoring it. |
2628 |
if (n.getScriptingVars(scope).contains(varInfos[i])) |
2655 |
if (declaredVariables.contains(varInfos[i])) |
2629 |
continue; |
2656 |
continue; |
2630 |
String varName = varInfos[i].getVarName(); |
2657 |
String varName = varInfos[i].getVarName(); |
2631 |
String tmpVarName = "_jspx_" + varName + "_" |
2658 |
String tmpVarName = "_jspx_" + varName + "_" |
Lines 2641-2647
Link Here
|
2641 |
continue; |
2668 |
continue; |
2642 |
// If the scripting variable has been declared, skip codes |
2669 |
// If the scripting variable has been declared, skip codes |
2643 |
// for saving and restoring it. |
2670 |
// for saving and restoring it. |
2644 |
if (n.getScriptingVars(scope).contains(tagVarInfos[i])) |
2671 |
if (declaredVariables.contains(tagVarInfos[i])) |
2645 |
continue; |
2672 |
continue; |
2646 |
String varName = tagVarInfos[i].getNameGiven(); |
2673 |
String varName = tagVarInfos[i].getNameGiven(); |
2647 |
if (varName == null) { |
2674 |
if (varName == null) { |
Lines 2666-2671
Link Here
|
2666 |
* given scope. |
2693 |
* given scope. |
2667 |
*/ |
2694 |
*/ |
2668 |
private void syncScriptingVars(Node.CustomTag n, int scope) { |
2695 |
private void syncScriptingVars(Node.CustomTag n, int scope) { |
|
|
2696 |
if (isFragment) { |
2697 |
// No need to declare Java variables, if we inside a |
2698 |
// JspFragment, because a fragment is always scriptless. |
2699 |
// Thus, there is no need to save/ restore/ sync them. |
2700 |
// Note, that JspContextWrapper.syncFoo() methods will take |
2701 |
// care of saving/ restoring/ sync'ing of JspContext attributes. |
2702 |
return; |
2703 |
} |
2704 |
|
2669 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
2705 |
TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); |
2670 |
VariableInfo[] varInfos = n.getVariableInfos(); |
2706 |
VariableInfo[] varInfos = n.getVariableInfos(); |
2671 |
|
2707 |
|