Link to home
Start Free TrialLog in
Avatar of sunmaster
sunmaster

asked on

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


Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Try:

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

Avatar of sunmaster
sunmaster

ASKER

tried...
but still cannot...
any other suggestion...?
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
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...?
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
What version of Tomcat are you running?

This is starting to sound like a bug :-(
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
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial