aspose file tools*
The moose likes Struts and the fly likes Request.getQueryString() returns null in the included JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Request.getQueryString() returns null in the included JSP" Watch "Request.getQueryString() returns null in the included JSP" New topic
Author

Request.getQueryString() returns null in the included JSP

Sivasankari Kadamban
Greenhorn

Joined: Feb 18, 2008
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Request.getQueryString() returns null in the included JSP