• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 598
  • Last Modified:

jsp:include with params

Hi all experts out there,

Say i got this page,a.jsp
....
 <jsp:include page="../../util/grid.jsp">
    <jsp:param name="__header" value="headerValues"/>
 </jsp:include>
....
and in grid.jsp I tried getting the __header value by,
<%
System.out.println("header param:::>"+request.getParameter("__header"));
%>

the problem is request.getParameter("__header") return a null value.
What is actually the problem...?

Thanks in advance


0
sunmaster
Asked:
sunmaster
  • 4
  • 4
1 Solution
 
TimYatesCommented:
Try:

 <jsp:include page="../../util/grid.jsp" flush="true">
    <jsp:param name="__header" value="headerValues"/>
 </jsp:include>

0
 
sunmasterAuthor Commented:
tried...
but still cannot...
any other suggestion...?
0
 
TimYatesCommented:
There must be something wrong with your code...  because that should work...

Try:

<%
  out.println( "header param:::>" + request.getParameter("__header") ) ;
%>

to make sure it appears in your browser...  

And make sure you have the same number of underscores in both pages (2)

Tim
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
sunmasterAuthor Commented:
still the same...
any ideas... Btw, I am using tomcat 5. if it any help... or is there any thing i need to set in web.xml...? or other thing else....?

and what is flush="true" use for...?
0
 
sunmasterAuthor Commented:
hi TimYates,

  I found out that somebody else also have this same problem from this site,
http://list.jahia.org/dev_list/msg00498.html.

  But i don't understand the sollution. Perhaps you can help me...?Thanks and i Really need your help.

sunmaster
0
 
TimYatesCommented:
What version of Tomcat are you running?

This is starting to sound like a bug :-(
0
 
sunmasterAuthor Commented:
hi,

i am using tomcat 5, and my web.xml is something like this,

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <context-param>
    <param-name>FI_CODE</param-name>
    <param-value>001912</param-value>
  </context-param>
  <context-param>
    <param-name>QUICK_LINK_NUM</param-name>
    <param-value>10</param-value>
  </context-param>
  <description>
      eMCMS Application
    </description>
  <display-name>eMCMS Application</display-name>
  <context-param>
    <param-name>CACHE_LOCATION</param-name>
    <param-value>D:/Tomcat/webapps/emcms/cache</param-value>
  </context-param>

  <filter>
    <filter-name>CheckPoint</filter-name>
    <filter-class>my.com.eprotea.emcms.filters.TaskCheckPointFilter</filter-class>
  </filter>
  <filter>
    <filter-name>XMLCacheFilter</filter-name>
    <filter-class>my.com.eprotea.emcms.cache.XMLCacheFilter</filter-class>
  </filter>
<!--  <filter>
    <filter-name>Compression Filter</filter-name>
    <filter-class>compressionFilters.CompressionFilter</filter-class>
    <init-param>
      <param-name>compressionThreshold</param-name>
      <param-value>10</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>1</param-value>
    </init-param>
  </filter>-->
  <filter>
    <filter-name>HttpPoster</filter-name>
    <filter-class>my.com.eprotea.emcms.filters.HTTPParameterParser</filter-class>
    <init-param>
      <param-name>XMLLocation</param-name>
      <param-value>D:/Tomcat/webapps/emcms/xml</param-value>
    </init-param>
    <init-param>
      <param-name>MsgHeaderName</param-name>
      <param-value>MsgHeader.xml</param-value>
    </init-param>
    <init-param>
      <param-name>RequestHeaderName</param-name>
      <param-value>RequestHeader.xml</param-value>
    </init-param>
    <init-param>
      <param-name>ResponseHeaderName</param-name>
      <param-value>ResponseHeader.xml</param-value>
    </init-param>
    <init-param>
      <param-name>DEBUG</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>READ_LOOPS</param-name>
      <param-value>5000</param-value>
    </init-param>
    <init-param>
      <param-name>WRITE_LOOPS</param-name>
      <param-value>5000</param-value>
    </init-param>
    <init-param>
      <param-name>XMLGatewayLocation</param-name>
      <param-value>http://192.168.2.104:8080/emcms-gateway/XMLGatewayServlet</param-value>
    </init-param>
  </filter>
  <filter>
    <filter-name>SignOnFilter</filter-name>
    <filter-class>my.com.eprotea.security.SignOnFilter</filter-class>
  </filter>
  <filter>
    <filter-name>XMLSortFilter</filter-name>
    <filter-class>my.com.eprotea.emcms.filters.XMLSortFilter</filter-class>
  </filter>
  <filter>
    <filter-name>Formatter</filter-name>
    <filter-class>my.com.eprotea.emcms.filters.Formatter</filter-class>
  </filter>

<!--  <filter-mapping>
    <filter-name>Compression Filter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>-->
  <filter-mapping>
    <filter-name>CheckPoint</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>XMLCacheFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>SignOnFilter</filter-name>
    <url-pattern>/RSE500MN</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>HttpPoster</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>XMLSortFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>  
  <filter-mapping>
    <filter-name>HttpPoster</filter-name>
    <url-pattern>/RSE500MN</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>XMLSortFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
    <filter-mapping>
    <filter-name>Formatter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>RSE500MN</servlet-name>
    <servlet-class>my.com.eprotea.signon.ECMSSignOn</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>NewServlet</servlet-name>
    <servlet-class>my.com.eprotea.signon.NewServlet</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>servletQuickLnk</servlet-name>
    <servlet-class>my.com.eprotea.emcms.maint.QuickLnk</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>GenFunctions</servlet-name>
    <servlet-class>my.com.eprotea.emcms.maint.GenFunctions</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>RSE500MN</servlet-name>
    <url-pattern>/RSE500MN</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>NewServlet</servlet-name>
    <url-pattern>/NewServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>servletQuickLnk</servlet-name>
    <url-pattern>/QuickLnk</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>GenFunctions</servlet-name>
    <url-pattern>/GenFunctions</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>/jsp/index.jsp</welcome-file>
    <welcome-file>/index.jsp</welcome-file>
  </welcome-file-list>
  <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/gen/ErrorPage.jsp</location>
  </error-page>
  <error-page>
    <exception-type>javax.security.auth.login.LoginException</exception-type>
    <location>/index.jsp</location>
  </error-page>
  <security-constraint>
    <display-name>Example Security Constraint</display-name>
    <web-resource-collection>
      <web-resource-name>Protected Area</web-resource-name>
      <!-- Define the context-relative URL(s) to be protected -->
      <url-pattern>/iss/*</url-pattern>
      <url-pattern>/acq/*</url-pattern>
      <!-- <url-pattern>/gen/*</url-pattern> -->
      <url-pattern>/xml/*</url-pattern>
      <url-pattern>/maint/*</url-pattern>
      <url-pattern>/util/*</url-pattern>
      <url-pattern>/index.jsp</url-pattern>
      <!--<url-pattern>/*</url-pattern>-->
      <!-- If you list http methods, only those methods are protected -->
      <http-method>DELETE</http-method>
      <http-method>GET</http-method>
      <http-method>POST</http-method>
      <http-method>PUT</http-method>
    </web-resource-collection>
    <auth-constraint>
      <!-- Anyone with one of the listed roles may access this area -->
      <role-name>emcms</role-name>
    </auth-constraint>
  </security-constraint>
  <!-- Default login configuration uses form-based authentication -->
  <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>emcmsRealm</realm-name>
    <form-login-config>
      <form-login-page>/signon.jsp</form-login-page>
      <form-error-page>/gen/ErrorPage.jsp</form-error-page>
    </form-login-config>
  </login-config>
  <!-- Security roles referenced by this web application -->
  <security-role>
    <role-name>emcms</role-name>
  </security-role>
</web-app>


but if i change my web.xml to

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
       version="2.4">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
      <welcome-file>
            index.jsp
        </welcome-file>
      <welcome-file>
            index.html
        </welcome-file>
      <welcome-file>
            index.htm
        </welcome-file>
    </welcome-file-list>
</web-app>


it WORKS!!! but this is not the web.xml that i want. Can you point out what wrong with my web.xml or something wrong with the filters...?

Please help,
Thanks,
sunmaster
0
 
TimYatesCommented:
All of these filters:

  <filter-mapping>
    <filter-name>CheckPoint</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>XMLCacheFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>HttpPoster</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>XMLSortFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>  
  <filter-mapping>
    <filter-name>XMLSortFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
  </filter-mapping>
    <filter-mapping>
    <filter-name>Formatter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

Will get called before your JSP...  Maybe one of them is stripping the parameters?  Can you try commenting them all out (it should work) then add them in one by one...  At a certain point, it will probably stop working...  then the last filter you added in is the one to look at...

Make sure it's chaining right...and not stripping request parameters

That is, assuming you have the code for it...

Tim
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now