This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
Consider Paul's rocket mass heater.
 
subject: Request.getQueryString() returns null in the included JSP
 
Similar Threads
A problem about the usage of tag jsp:param
How can I consolidate some duplicate JSTL code in my JSP?
Include one jsp into another at runtime
Struts module problem
ways to include a servlet from a JSP