p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   JSP Basics (http://p2p.wrox.com/forumdisplay.php?f=92)
-   -   Parse JSTL XML inside JSF (http://p2p.wrox.com/showthread.php?t=81177)

prss October 8th, 2010 08:57 AM

Parse JSTL XML inside JSF
I'm working on a project which I need to generate a form dynamically. The user chooses the component he wants to put on the screen and the program adds it in the form. To do so, I'm using XML to define the current state of the form and at first sight I thought in using XSLT to make the transformation to JSF but now I am evaluating JSTL too. Regarding the last one, I have a problem.

Suppose I have this xml file (a questionnaire with two inputTexts):


    <component name='input'>
    <component name='input'>

And this JSTL file:


<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<x:parse var="doc" xml="${questionarioXSLBean.xml}"/>

<x:forEach var="n" select="$doc/questionario/componente">
 <x:if select="$n/@nome = 'input'">
  <x:set var="id" select="$n/id" />
  <h:inputText id="#{id}"/>

The problem is in this line: <h:inputText id="#{id}"/> 'cause #{id} doesn't return anything (I want to use the value that is in xml file and assigned in id variable).

Can anyone help me? Thanks in advance!

All times are GMT -4. The time now is 11:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.