java - Pass XML document via attribute or body to JSP custom tag -


I wonder if an XML document is pure jstl-defined JSP custom tag either: Custom tag body, such as:

  & lt; Mt: mytag & gt; & Lt; People & gt; & Lt; Person's name = "bob" age = "23" /> & Lt; Person's name = "litigation" age = "45" /> & Lt; Person's name = "mo" age = "35" /> & Lt; / People & gt; & Lt; MT: mytag & gt;   

Or, in the form of a tag attribute such as:

  & lt; Mt: mytag message = "http: //link.to.document.xml" / & gt;   

This is an auto tag

   & Lt;% @ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c"%> & Lt;% @ taglib uri = "http://java.sun.com/jsp/jstl/xml" prefix = "x"%> & Lt;% @ attribute name = "message"%> Or & lt; Jsp: doBody var = "Message" /> & Lt; X: parse var = "a" doc = "$ {message}" /> & Lt; X: choose forEach var = "current" = "$ a / people / person" & gt; & Lt; Ul & gt; & Lt; Li & gt; Name & lt; X: Select outside = "$ current / name @" /> Age & lt; X: out selection = "$ current / age" /> & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / X: foreach & gt; It is possible to process an XML with JSTL from within JSTL, basically copying the code after each and pasting it in JSP and copying the code. This page also works to get the XML request as a page / GET parameter and processes it in the page. Otherwise, while doing the above examples, there are various errors of this type:  
  PWC6197: An error occurred on the line: 9 in jsp file: / WEB-INF / Tags / test2.tag PWC6199: Generated servlet error: javax.servlet.jsp.jstl.core.LoopTagSupport can not access class file for Javax.servlet.jsp.jstl.core.LoopTagSupport not foundPWC6197: one in line Error occurred: In the 9 jsp file: /WEB-INF/tags/test2.tag PWC6199: generated servlet error: Icons Icons can not be found: method setpage syntax (javax.servlet.jsp. PageContext) Location: Variable _jspx_th_x_forEach_0 .......   

Please note that it is entirely possible to process the body content or an attribute is a non-pure JSTL The link inside (with Java code) is just wondering if such features of JSTL + EL are.

EDIT: Resolution

It seems that the Netbeans IDE does not have JSTL libraries attached to it by D. No fault. You fix it by libraries - & gt; Add Library- & gt; Import-> Jstl 1.1- & gt; Add Library

This works.

  & lt;% @ taglib tagdir = "/ web-ANF / tag" prefix = "MT"%> & Lt;% @ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c"%> & Lt;% @ taglib uri = "http://java.sun.com/jsp/jstl/xml" prefix = "x"%> & Lt; C: set var = "message" & gt; & Lt; People & gt; & Lt; Person's name = "bob" age = "23" /> & Lt; Person's name = "litigation" age = "45" /> & Lt; Person's name = "mo" age = "35" /> & Lt; / People & gt; & Lt; / C: Set & gt; & Lt; Mt: mytag message = "$ {message}" />   

Actually, your first code block (body usage) works for me as well. If you want to use a file, use the following.

  & lt;% @ taglib tagdir = "/ WEB-INF / tags" prefix = "mt"%> & Lt; Mt: mytag messageUrl = "http: //link.to.document.xml" />   

and tag file;

  & lt;% @ tag description = "XML parser" page encoding = "UTF-8"%> & Lt;% @ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c"%> & Lt;% @ taglib uri = "http://java.sun.com/jsp/jstl/xml" prefix = "x"%> & Lt;% @ attribute name = "messageUrl"% & gt; & Lt; C: import url = "$ {messageUrl}" var = "message" /> & Lt; X: parse var = "a" doc = "$ {message}" /> & Lt; X: choose forEach var = "current" = "$ a / people / person" & gt; & Lt; Ul & gt; & Lt; Li & gt; Name & lt; X: Select outside = "$ current / name @" /> Age & lt; X: out selection = "$ current / age" /> & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / X: foreach & gt;   

Regarding your error messages, please tell us which web server you are using. Also, tell which JSTL jar you downloaded and where?

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -