我想用xml为html也进行布局,然后再向jsp页面提交,不知道这种想法是否对,在实现上遇到一个问题,恳请大侠们解决下
xml文件
<?xml version="1.0" encoding="GBK"?>
<?xml-stylesheet type="text/xsl" href="divx.xsl"?>
<cc>
<property id="bianhao" name="编号"
ltop="112" lleft="111" lwidth="55" lheight="59"
vtop="112" vleft="300" vwidth="55" vheight="59">
<![CDATA[<input type="text" value=""></input>]]> </property>
<property id="xingming" name="姓名"
ltop="333" lleft="111" lwidth="55" lheight="59"
vtop="333" vleft="300" vwidth="55" vheight="59">
<![CDATA[<input type="checkbox" value="ss"></input>]]>
</property>
</cc>xsl文件
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html><body>
<form action="../test.jsp" method="post"><div>
<xsl:for-each select="//property">
<div>
<div>
<xsl:attribute name="style">background:#F8E0C0;border-color:#F8E0C0;left:<xsl:value-of select="@lleft"/>;top:<xsl:value-of select="@ltop"/>;width:<xsl:value-of select="@lwidth"/>;height:<xsl:value-of select="@lheight"/>;position:absolute</xsl:attribute>
<label><xsl:value-of select="@name"/></label>
</div>
<div>
<xsl:attribute name="style">background:#F8E0C0;border-color:#F8E011;left:<xsl:value-of select="@vleft"/>;top:<xsl:value-of select="@vtop"/>;width:<xsl:value-of select="@vwidth"/>;height:<xsl:value-of select="@vheight"/>;position:absolute</xsl:attribute>
<xsl:value-of select="./text()" disable-output-escaping="yes"/>
</div>
</div>
</xsl:for-each>
<input type="submit" value="提交" />
</div></form>
</body></html>
</xsl:template>
</xsl:stylesheet>test.jsp页面
<%
Enumeration e = (Enumeration)request.getParameterNames();
while(e.hasMoreElements()){
String parName=(String)e.nextElement();
}
System.out.println("ok!~~~~~~\n+++++++++++++++" + e.toString());
%>前面用xsl为xml布局可以实现,是参照论坛 hookee 写的,可是,在提交后,test.jsp页面无法获得所有的标签name,e.toString()为java.util.Hashtable$EmptyEnumerator@193f6e2,请问能否实现?怎么解决?
xml文件
<?xml version="1.0" encoding="GBK"?>
<?xml-stylesheet type="text/xsl" href="divx.xsl"?>
<cc>
<property id="bianhao" name="编号"
ltop="112" lleft="111" lwidth="55" lheight="59"
vtop="112" vleft="300" vwidth="55" vheight="59">
<![CDATA[<input type="text" value=""></input>]]> </property>
<property id="xingming" name="姓名"
ltop="333" lleft="111" lwidth="55" lheight="59"
vtop="333" vleft="300" vwidth="55" vheight="59">
<![CDATA[<input type="checkbox" value="ss"></input>]]>
</property>
</cc>xsl文件
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html><body>
<form action="../test.jsp" method="post"><div>
<xsl:for-each select="//property">
<div>
<div>
<xsl:attribute name="style">background:#F8E0C0;border-color:#F8E0C0;left:<xsl:value-of select="@lleft"/>;top:<xsl:value-of select="@ltop"/>;width:<xsl:value-of select="@lwidth"/>;height:<xsl:value-of select="@lheight"/>;position:absolute</xsl:attribute>
<label><xsl:value-of select="@name"/></label>
</div>
<div>
<xsl:attribute name="style">background:#F8E0C0;border-color:#F8E011;left:<xsl:value-of select="@vleft"/>;top:<xsl:value-of select="@vtop"/>;width:<xsl:value-of select="@vwidth"/>;height:<xsl:value-of select="@vheight"/>;position:absolute</xsl:attribute>
<xsl:value-of select="./text()" disable-output-escaping="yes"/>
</div>
</div>
</xsl:for-each>
<input type="submit" value="提交" />
</div></form>
</body></html>
</xsl:template>
</xsl:stylesheet>test.jsp页面
<%
Enumeration e = (Enumeration)request.getParameterNames();
while(e.hasMoreElements()){
String parName=(String)e.nextElement();
}
System.out.println("ok!~~~~~~\n+++++++++++++++" + e.toString());
%>前面用xsl为xml布局可以实现,是参照论坛 hookee 写的,可是,在提交后,test.jsp页面无法获得所有的标签name,e.toString()为java.util.Hashtable$EmptyEnumerator@193f6e2,请问能否实现?怎么解决?
比如:<input type="hidden" name="userid" value="<xsl:value-of select='@id'"/>
<?xml version="1.0" encoding="GBK"?>
<?xml-stylesheet type="text/xsl" href="divx.xsl"?>
<cc>
<property id="bianhao" name="编号"
ltop="112" lleft="111" lwidth="55" lheight="59"
vtop="112" vleft="300" vwidth="55" vheight="59">
<![CDATA[ <input type="text" name="c1" value=""> </input>]]>
</property>
<property id="xingming" name="姓名"
ltop="333" lleft="111" lwidth="55" lheight="59"
vtop="333" vleft="300" vwidth="55" vheight="59">
<![CDATA[ <input type="checkbox" name="c2" value="ss"> </input>]]>
</property>
</cc>
<property id="bianhao" name="编号"
ltop="112" lleft="111" lwidth="55" lheight="59"
vtop="112" vleft="300" vwidth="55" vheight="59">
<![CDATA[ <input type="text" name="abc" value="xxx"/>]]> </property>
<property id="xingming" name="姓名"
ltop="333" lleft="111" lwidth="55" lheight="59"
vtop="333" vleft="300" vwidth="55" vheight="59">
<![CDATA[ <input type="checkbox" name="xxx" value="ss"/>]]>
</property>
</cc>