java - Passing parameters between jsp and xsl -
i have problem between jsp page , xsl, want pass parameter between jsp , xsl never set in xsl.
jsp page ;
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%> <%! private string getval(string param, httpservletrequest request) { return request.getparameter("fname"); } %> <% string num = getval("value", request); %> <div id="section" class="col-xs-10 col-sm-10 col-md-8"> <c:import url="/monxml.xml" var="inputdoc" /> <c:import url="/viewannonce.xsl" var="stylesheet" /> <x:transform xml="${inputdoc}" xslt="${stylesheet}" > <x:param name="numannonce" value="${num}"/> </x:transform> </div> xsl :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html" encoding="utf-8" doctype-public="-//w3c//dtd xhtml 1.0 transitional//en" doctype-system="http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" /> <xsl:param name="numannonce"/> <xsl:template match="/"> <xsl:template match="/"> <!-- creation de la liste des annonces --> <xsl:for-each select=".//annonce[attribute::id=$numannonce]"> <div id="article" class="row"></div> </xsl:for-each> </xsl:template> `
the getval("value", request); return correct value.
thanks.
you have declared num variable using jsp scriptlet, don't think can access ${num} , try accessing scriptlet :
<x:param name="numannonce" value="<%=num%>"/>
Comments
Post a Comment