Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 8th, 2010, 08:57 AM
Registered User
 
Join Date: Oct 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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):

Code:
<questionnaire>
    <component name='input'>
        <id>input1</id>
    </component>
    <component name='input'>
        <id>input2</id>
    </component>
</questionnaire>
And this JSTL file:

Code:
<%@ 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}"/>
 </x:if>
</x:forEach>
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!
P.S.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML to JSF prss XSLT 2 October 6th, 2010 11:44 AM
Building Web 2.0 UIs with JSF, Realtime Updates with JSF & Ajax Push Taught at GIDS Shaguf J2EE 0 March 4th, 2010 07:54 AM
Building Web 2.0 UIs with JSF, Realtime Updates with JSF & Ajax Push Taught at GIDS Shaguf J2EE 0 March 4th, 2010 07:53 AM
Using XSLT to tranform XML into JSF pdimilla XSLT 4 July 3rd, 2009 03:50 AM
JSTL, XML query ph3n0m JSP Basics 1 January 26th, 2006 08:11 AM



All times are GMT -4. The time now is 10:00 AM.


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