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


LVL 1
sunmasterAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.