Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000852 [Resin] minor always 01-10-06 08:48 01-10-06 15:44
Reporter ferg View Status public  
Assigned To ferg
Priority urgent Resolution fixed  
Status closed   Product Version 3.0.17
Summary 0000852: jsp:include issue
Description (rep by Rudy D'Hauwe)

We have an issue with in Resin 3.0.17, here is an example
"index.jsp" page:

<%
String nextPage = "next.jsp?param1=value1";
String param2 = "value2";
String param3 = "value3";
%>

The next.jsp page prints the request parameters:

param1=<%= request.getParameter("param1"); %>
param2=<%= request.getParameter("param2"); %>
param3=<%= request.getParameter("param3"); %>

With Resin 3.0.17 this results in :

param1=value1?param2=value2
param2=null
param3=value3

The problem occurs when the page attribute of jsp:include is a runtime-attribute,
and contains a query.

I implemented a fix for this problem in com.caucho.jsp.java.JspInclude.java.

Original code:

public void generate(JspJavaWriter out)
throws Exception
{
boolean hasQuery = false;

if (_page == null)
throw error(L.l(" expects a `page' attribute. `page'
specifies the path to include."));


if (hasRuntimeAttribute(_page)) {
out.print("pageContext.include(");
out.print(getRuntimeAttribute(_page));
}
else {
String page = _page;

out.print("pageContext.include(");
out.print(generateParameterValue(String.class, _page));

if (_page.indexOf('?') >= 0)
hasQuery = true;
}

if (_params != null) {
generateIncludeParams(out, _params, hasQuery);
}

out.print(", " + _flush);

out.println(");");
}



Bug fix replacement for the generate method (not yet optimized for performance) :

public void generate(JspJavaWriter out)
throws Exception
{
boolean hasQuery = false;

if (_page == null)
throw error(L.l(" expects a `page' attribute. `page'
specifies the path to include."));

if (hasRuntimeAttribute(_page)) {

out.println("if (" + getRuntimeAttribute(_page) + ".indexOf('?')>=0) {");

out.print("pageContext.include(");
out.print(getRuntimeAttribute(_page));
if (_params != null) {
generateIncludeParams(out, _params, true);
}
out.print(", " + _flush);
out.println(");");

out.println("} else {");

out.print("pageContext.include(");
out.print(getRuntimeAttribute(_page));
if (_params != null) {
generateIncludeParams(out, _params, hasQuery);
}
out.print(", " + _flush);
out.println(");");

out.println("}");

}
else {
String page = _page;

out.print("pageContext.include(");
out.print(generateParameterValue(String.class, _page));

if (_page.indexOf('?') >= 0)
hasQuery = true;

if (_params != null) {
generateIncludeParams(out, _params, hasQuery);
}

out.print(", " + _flush);
out.println(");");
}
}
Additional Information
Attached Files

- Relationships

- Notes
(0000667)
ferg
01-10-06 15:44

jsp/15lb, jsp/15m0
 

- Issue History
Date Modified Username Field Change
01-10-06 08:48 ferg New Issue
01-10-06 10:19 ferg Project Quercus => Resin
01-10-06 11:33 rudy Issue Monitored: rudy
01-10-06 15:44 ferg Note Added: 0000667
01-10-06 15:44 ferg Assigned To  => ferg
01-10-06 15:44 ferg Status new => closed
01-10-06 15:44 ferg Resolution open => fixed
01-10-06 15:44 ferg Fixed in Version  => 3.0.18


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker