Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

jsp:include with params

Posted on 2004-10-22
10
Medium Priority
?
588 Views
Last Modified: 2013-11-18
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
Comment
Question by:sunmaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
10 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12378879
Try:

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

0
 
LVL 1

Author Comment

by:sunmaster
ID: 12379201
tried...
but still cannot...
any other suggestion...?
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12379261
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Author Comment

by:sunmaster
ID: 12386960
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
 
LVL 1

Author Comment

by:sunmaster
ID: 12396745
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
 
LVL 35

Expert Comment

by:TimYates
ID: 12398219
What version of Tomcat are you running?

This is starting to sound like a bug :-(
0
 
LVL 1

Author Comment

by:sunmaster
ID: 12408138
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
 
LVL 35

Accepted Solution

by:
TimYates earned 200 total points
ID: 12408461
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question