• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request.getQueryString() returns null in the included JSP

 
Sivasankari Kadamban
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We use OC4J 10.1.3.3 as our application server.

We have a simple struts application with 2 JSPs page1.jsp which includes page2.jsp.
When we call the page1.jsp directly from the URL,
http://<sysno>:<port>/test/page1.jsp?cid=1
the request.getQueryString() returns correct value in page2.jsp.

When we use a struts action to redirect to page1.jsp, request.getQueryString() returns null
in page2.jsp, Althou the request parameters are
available.
http://<sysno>:<port>/test/test.do?cid=1
i.e test.do forwards to page1.jsp.

This works fine in OC4J 10.1.2.
Any pointers?

Here is our code
struts-config.xml
=================
<?xml version="1.0" encoding="windows-1252" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<action-mappings>
<action path="/test"
type="com.ti.education.TestQuery"
name=""
scope="session"
validate="false">
<forward name="test" path="/page1.jsp" redirect="false"/>
</action>
</action-mappings>
</struts-config>


page1.jsp
=========
<%out.println("request.getQueryString() in page1.jsp: " + request.getQueryString()+"</br>"); %>
<jsp:include page="page2.jsp">
<jsp aram name="testparam" value="testvalue"/>
<jsp aram name="testparam2" value="testvalue2"/>
</jsp:include>

page2.jsp
=================
<%@ page import="java.util.Enumeration" %>
<%

out.println("request.getQueryString() in page2.jsp: " + request.getQueryString());
Enumeration paramNames = request.getParameterNames();
out.println("<br/>Request parameters are:");
while(paramNames.hasMoreElements()) {
String paramName = (String)paramNames.nextElement();
String paramValue = (String)request.getParameter(paramName);
out.println("<br/>name = " + paramName + "; value = " + paramValue);
}
%>
Thanks,
Sivasankari
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic