Struts2 tag get s: Param value subpage get s: include S: Param Value

Source: Internet
Author: User

The parameter <s: param> is used on the home page. The parameter cannot be obtained using the struts2 tag on the Child page.

<S: property value = "# request. Operation"/>

Or <s: property value = "operation"/>

Or <s: property value = "% {# ATTR. Operation}"/>

No value is obtained,

I found a buddy's original article on the Internet:

Explanation:

I read the struts2 document, saying that ognl cannot be obtained from valuestack because include does not update valuestack. This document also describes how to use jstl on the page:

$ {Param. Operation}

However, I do not want to mix struts labels and jstl labels for the purpose of unified the whole site. Therefore, I hope to solve it only by using struts2. According to the Buddy's article, the solution is as follows:

Input parameters on the parent page:

<S: Include value = "/JSP/include_vedio/head. JSP "> <% -- upload the page title -- %> <s: Param name =" page_title "> modify the page title </S: param> </S: Include>

Add the following code to the subpage:

<% @ Page import = "com. opensymphony. xwork2.ognl. ognlvaluestack "%> <% (ognlvaluestack) request. getattribute ("struts. valuestack ")). set ("page_title", request. getparameter ("page_title"); %> <s: If test = "page_title! = NULL "> <s: Property escape =" false "value =" page_title "/>-website </S: If> <s: else> website </S: else>

Then you can use the struts2 tag <s: property value/> to obtain the value.

From: http://wenku.baidu.com/view/b23a4e26aaea998fcc220eef.html

Thanks to the original author. This article is based on the original article.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.