Hierarchy tree with XML attributes in jsp
hi,
i need to build a hierarchy tree. data(parent and child) should be read from xml file. data is attributes of nodes in xml. i need to write the JSP code for above functionality. please help me. thanks in advance.
Check this link for further details.
http://www.dpawson.co.uk/xsl/sect4/N10301.html
http://www.devx.com/getHelpOn/Article/11874
The solution is based on XSLT approach. That can be still converted in other server side technologies.
Regards,
Vikrant.
Similar Messages
-
Using BPEL console testing with XML attributes
I'm having trouble with using an XML attribute in my BPEL process. When I put an attribute on my input element, the BPEL Console test page no longer works. Here's what I'm doing:
I create a synchronous new BPEL project in JDeveloper using the default input and output XSDs, and add a simple assign to assign the input to the output. When I deploy this and look at it in BPEL console, I can see the input field and enter my value to test.
Now I go back into JDeveloper and add an attribute to the input element, and then redeploy my process. Now when I go into BPEL console, the Initiate tab no longer has any field for me to enter my value. Clicking the XML Source radio button doesn't help either. (I also tried invoking the BPEL process web service through the app server control - same issue.)
I'm using JDeveloper 10.1.3.3 with App Server 10.1.3.3.0. Does anyone know how to make the BPEL Console testing work with XSDs that contain attributes?
Thanks,
SkipA bit more info on this. It doesn't appear that the problem is limited to the console tester. I created another BPEL process which calls my original process, and attempted to set the attribute on the input using the Assign activity. JDeveloper generated this:
<assign name="Assign_1">
<copy>
<from variable="inputVariable" part="payload"
query="/client:TestAttributes2ProcessRequest/client:input"/>
<to variable="Invoke_1_process_InputVariable" part="payload"
query="/ns1:TestAttributesProcessRequest/ns1:input"/>
</copy>
<copy>
<from expression="'bob'"/>
<to variable="Invoke_1_process_InputVariable" part="payload"
query="/ns1:TestAttributesProcessRequest/ns1:input/@attribute1"/>
</copy>
</assign>
As you can see this is mapping a variable into the /TestAttributesProcessRequest/input element and then attempting to set the attribute of that element to the value 'bob'. This compiles just fine but when this code is executed, this error occurs:
Error in <assign> expression: <to> value is empty at line "87". The XPath expression : "" returns zero node, when applied to document shown below:
oracle.xml.parser.v2.XMLElement@7efe7efe
(Line 87 is query="/ns1:TestAttributesProcessRequest/ns1:input/@attribute1"/>)
Is there something wrong with this generated code? Do I need to do some kind of custom code to set attributes, instead of using the graphical tools in JDeveloper? -
Hello!
Can anyone help me about how can i manipulate an activex tree with comctl32.ocx????
i created an activex item (that will be the tree), and i inserted some node into the tree. it works fine, but how can i find a node, or get the key and text value??? how can i delete??? these methods are unknow for me...
is there a documentation, that write down the funnction of all methods??? Please HELP!!! It would be a good solution to create a fast, and more powerful hierarchial tree in Forms6i. But should be a description about the COMCTL32.OCX "ComCTL.Treectl.1" methods...
thanks in advance: [email protected] Tamas UrbanThis is a Microsoft Control so http://msdn.microsoft.com should be the place to go
-
Problem with boolean attribute of JSP tag
Hi,
I've being trying to use a custom JSP tag, which has a boolean attribute, declared in the TLD as follows:
<attribute>
<name>checked</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
The JSP code snippet is:
<ui:check checked="<%= myBean.isChecked() %>"/>
where myBean.isChecked() returns a boolean value (primitive type).
It works fine on some web containers, but it causes a JSP compilation error on Oracle9iAS 9.0.3 Java Edition, which looks like the following:
Method toBoolean(boolean) not found in class test. _jsp_taghandler_57.setChecked( OracleJspRuntime.toBooleanObject( toBoolean( myBean.isChecked())));
After decompiling the container's JSP parser, I found what I think it's a bug. The java class generated by the JSP parser does not define a toBoolean method, and neither do its superclasses. The method is defined on the OracleJspRuntime class! I think the correct code would have to be something like:
OracleJspRuntime.toBooleanObject(OracleJspRuntime.toBoolean(...))
If I'm correct, then the "convertExpression" method of the "oracle.jsp.parse.JspUtils" class must be changed, because it outputs such wrong code for not just boolean types, but for all the primitive types.
So, has anyone ever faced this problem before? Does it have a workaround, or a patch? Is it included on the bug fixes for the 9.0.4 release?
Thanks!Instead of:
out.println("<body onload ="+strAlert+">");
Try this:
out.println("<body onload =\""+strAlert+\"">");
Add two \" around the alert call. -
Setting the ALV Hierarchy tree with grid line between the columns and rows
Hi Experts,
I would like to ask if there is any suggestion on setting the ALV hierarchy tree to be separated by grid line between the columns and rows just like how it is display the same way in normal ALV grid.
Thanks in advance.Hi Lin,
The requirement which you have stated is not possible.
Lin,
Also i have a query regarding BADI ZME_PROCESS_REQ_CUST, which you had raised on SDN. You have marked the question as solved/answered.
Changing the data of a customize field in purchase requisition
Could you please let me know, the steps you did to update the screen fields through the BADI.
I would really appreciate your reply, because i am facing exactly the same problem which you have mentioned.
Thanks,
Best regards,
Prashant -
Manual Drag and Drop from Tree to Tree with XML dataProvider
Been struggling with Drag-n-Drop between Tree controls. As far as I can tell, it doesn't work very well.
I have boiled it down to a minimal project below and would be ever so grateful if someone can tell me what I am doing wrong.
The complete MXML application file is below. Flex 3.5.
Two trees side-by-side. One has XML that I want to drag over to the drop tree.
On the DragOver() event, I select the node which is given to me by the calculateDropIndex() function.
After startup; first open the L1 branch on the left and drag L11 over and drop it on the right Tree.
Looks good, root node is selected/highlighted and dropFeedback is correct and dropping the node drops it as a child of "Start Here".
Open the Start Here root node to see it.
Now proceded to #1 below.
Here are the problems:
1) Drag "L12" from the left tree over to the middle of the right tree (below "L11" just dropped). "L11" will not be selected. The Selected node (with dropIndex=4) will be the entire new nested XML "<L><L11/></L>"; and therefore only "Start Here" node will be highlighted. Drop "L12" anyway. So, it is acting like selectedIndex = <anynumber> will only select the root node. How do I get the new L11 to show as a drop target?
2) Now drag "L21" from the left tree onto the right tree; again starting below all nodes on the right tree. Selected node will not change until you drag it above #2 out of 3. Then, you can drag it anywhere, and correctly highlight/select any node as the target, and get that node in code. This is a problem. Go ahead and drop it anywhere. Now if you drag, for example, L22 from the left it will correctly highlight/select any node without having to first drag above #2 in the list.
3) Now, grab and drag L11 a second time and drop it at the bottom on the right. Drag L23 over. No matter which L11 you hover over, it highlights the one at the bottom. How can this be right?
Those are the bugs I would like to figure out. If I am doing it wrong, I sure would like to know what I am doing wrong. The code below is distilled down to one simple mxml application module.
Thanks,
Jeff
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.core.IUIComponent;
import mx.events.DragEvent;
import mx.managers.DragManager;
Bindable]
private var dragXML:XML =
<Tree label="root"><L1 label="L1">
<L11 label="L11"/>
<L12 label="L12"/>
</L1>
<L2 label="L2">
<L21 label="L21"/>
<L22 label="L22"/>
<L23 label="L23"/>
</L2>
</Tree> ;
Bindable]
private var dragXMLListCollection:XMLListCollection = new XMLListCollection(dragXML.*);
Bindable]
private var dropXML:XML =
<Tree label="root"><L label="Start Here"/>
</Tree> ;
Bindable]
private var dropXMLListCollection:XMLListCollection = new XMLListCollection(dropXML.*);
// ************* Drag Drop Events ********************
private function dragEnter(evt:DragEvent):void
if (evt.dragSource.hasFormat("treeItems")) DragManager.acceptDragDrop(IUIComponent(evt.target));}
private function dragOver(evt:DragEvent):void
// Calculate dropindex and set selected item
var dropIndex:int = dropTree.calculateDropIndex(evt);dropTree.selectedIndex = dropIndex;
// setting the selected item based on calculateDropIndex()
var selNode:XML = dropTree.selectedItem as XML; // Getting XML for selected node in Tree
var selNodeName:String = (selNode != null ? selNode.localName() : "");
// Get dragged XML
var dragNode:XML = XML(evt.dragSource.dataForFormat("treeItems")[0]);
var dragNodeName:String = dragNode.localName();
trace(evt, "\n", dropIndex, "\n", (selNode ? selNode.toXMLString() : "null"), "\n", dragNode.toXMLString());
// you cannot drop a shorter name on a longer name
if ((dragNodeName.length >= selNodeName.length) && (selNode != null)) DragManager.showFeedback(DragManager.COPY);
else DragManager.showFeedback(DragManager.NONE);}
private function dragDrop(evt:DragEvent):void
// get selected node in drop tree
var selNode:XML = dropTree.selectedItem as XML; //selected in dragOver() event
// Get dragged XML
var dragNode:XML = XML(evt.dragSource.dataForFormat("treeItems")[0]);
// Drop logic
// Compare dragNode.localName().length to dropNode.localName().length
// if drag longer; drop as child
// if drag is equal; drop as sibling
// Drag can never be shorter in this example.
var isChild:Boolean = String(dragNode.localName()).length > String(selNode.localName()).length;
if (isChild){
selNode.insertChildAfter(
null, dragNode);}
else
selNode.parent().insertChildAfter(selNode, dragNode);
]]>
</mx:Script>
<mx:Tree id="dragTree" width="30%" showRoot="true" height="100%" labelField="@label"dataProvider="
{dragXMLListCollection}"dragEnabled="
true" dragMoveEnabled="false" dropEnabled="false" />
<mx:Tree id="dropTree" width="30%" showRoot="true" height="100%" labelField="@label"dataProvider="
{dropXMLListCollection}"dragEnter="dragEnter(event);" dragDrop="dragDrop(event);" dragOver="dragOver(event);"
/>
</mx:Application>I just found out that by setting the dataProvider for each tree to the XML variable instead of the XMLListCollection variable, problems #1 and #2 went away!
But the documentation says to use an XMLListCollection if you will be dynamically changing the tree contents.
And, I just found out that #1 returns if I specify showRoot="false". But with it set to "true" that problem goes away. Is there some sort of minimum XML required to make drag-n-drop work on these Tree controls?
Hmmmm. It appears that (for #3) the calculateDropIndex() will always return the last matching XML node - by name - in the tree. -
Help Needed with XML Attribute Access (Bold/Italics)
Hi,
I have a form that displays data in livecycle designer. When someone imports an xml file into the form in Adobe Acrobat it should be able to display some data as bolded and some italicized based on the xml file.
Here is the sample xml file
<Table1>
<Row1>
<Cell1 style="none">1</Cell1>
<Cell2 style="bold">2</Cell2>
<Cell3 style="italics">3</Cell3>
</Row1>
</Table1>
And the output should be:
1 2 3
Can someone please help! If the xml file should be designed differently please let me know.
Thank you!Paul,
Thanks for the help! I tried it out and it worked. One last question please. According to your explanation I added to the xml file the tags
<body xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns="http://www.w3.org/1999/xhtml" xfa:APIVersion="Acroform:2.7.0.0" xfa:spec="2.1">
<p style="font-weight:bold;">2</p>
</body>
do I need to place this body tag around each number or can I place it in one location in the xml file?
Thanks again. -
Frm-47313 Invalid Query for Hierarchy tree
Hello. i am trying to create a hierarchy tree with the following query:
SELECT 1, level, n.name, null, hn.nde_id
FROM cerpt_nodes n, cerpt_hierarchy_nodes hn
WHERE n.id = hn.nde_id
AND hn.hir_id = 1
CONNECT BY PRIOR hn.nde_id = hn.nde_id_parent_of
START WITH hn.ntp_code='ROOT';
I check the table and column names, they are correct. I tried to create tree with scott.emp table, I have no problem. The only different is this query has nested tables and where clause. Is that I cannot use WHERE clause and nested tables? Can anybody tell me what I have done wrong? Thank you very muchI had problems with joins in the same SQL statement using the Connect Prior By statement. Try creating a view over your nested tables then create the SQL statement for the tree using the view.
I ended up having a lot of problems using the tree control. I ended up modifing my database design to accomodate the short falls of the Connect Prior By statement.
Hope this helps.
Jamie -
Mar 29, 2010 4:22 AM
Hi
I am working with XML Project in indesign CS3. In my document have the following xml elements
<emphasis style="italic">Italic text</emphasis>
<emphasis style="bold">bold text</emphasis>
<emphasis style="bold-italic">Bold Italic text</emphasis>
<emphasis style="sup">Superscript text</emphasis>
<emphasis style="sub">Subscript text</emphasis>
I have a same element name but distinguish with attribute, i need to control styles with this attribute.
Can you please help me, how to control style with XML attributes.
Thanks in Advance
RajasekarYou need to add the InDesign namespace in each tag to apply different character styles based on the formatting.
-
Hi all,
i'm new to flex.I have a problem regarding XML
attributes."How to get the XML attribute value from the xml file to
Flex application using HTTPService".I tried but it is coming only
one attribute value.
First i have to get the attribute values from the XML file
and display in AdvancedDataGrid with tree structure.
Here i will send my XML file and MXML file...
Can u see and check my code............plzzz
XML file................
<?xml version="1.0" encoding="UTF-8"?>
<todolist>
<folder state="" label="Today todo list" isBranch="true"
>
<folder cat="Travel" state="High" duedate="3/09/2008"
isBranch="false" label="book tickets" />
<folder cat="Social" state="Low" duedate="4/09/2008"
isBranch="false" label="Meeting at 7pm" />
<folder state="" isBranch="true" label="Home " >
<folder cat="Home" state="High" duedate="3/09/2008"
isBranch="false" label="Pay power bill" />
<folder cat="Home" state="High" duedate="3/09/2008"
isBranch="false" label="Pay rent" />
<folder cat="Home" state="Low" duedate="3/09/2008"
isBranch="false" label="Call parents" />
<folder cat="Home" state="Low" duedate="3/09/2008"
isBranch="false" label="Attend John birthday party" />
<folder cat="Home" state="Medium" duedate="3/09/2008"
isBranch="false" label="Special Updates" />
<folder cat="Home" state="high" isBranch="false"
label="get Dr. appointment" />
</folder>
<folder state="" isBranch="true" label="Office " >
<folder cat="Off" state="High" isBranch="false"
label="Meeting at 5pm" />
<folder cat="Off" state="Low" isBranch="false"
label="Complete document and send to client" />
<folder cat="Off" state="Low" isBranch="false"
label="Interviews and Transcripts" />
<folder cat="Off" state="High" isBranch="false"
label="Set Deployment machine" />
<folder cat="Off" state="High" isBranch="false"
label="send status reports" />
</folder>
</folder>
</todolist>
MXML file............
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute"
initialize="adgService.send()">
<mx:HTTPService id="adgService" url="adg.xml"/>
<mx:AdvancedDataGrid
dataProvider="{adgService.lastResult.todolist.folder}">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="Name"
dataField="label"/>
<mx:AdvancedDataGridColumn headerText="Age"
dataField="state"/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Application>
Thnaks & Regards
edeewan"edeewan" <[email protected]> wrote in
message
news:[email protected]...
> Hi all,
> i'm new to flex.I have a problem regarding XML
attributes."How to
> get
> the XML attribute value from the xml file to Flex
application using
> HTTPService".I tried but it is coming only one attribute
value.
>
> First i have to get the attribute values from the XML
file and display in
> AdvancedDataGrid with tree structure.
> Here i will send my XML file and MXML file...
> Can u see and check my code............plzzz
>
> XML file................
>
> <?xml version="1.0" encoding="UTF-8"?>
> <todolist>
> <folder state="" label="Today todo list"
isBranch="true" >
>
> <folder cat="Travel" state="High" duedate="3/09/2008"
isBranch="false"
> label="book tickets" />
> <folder cat="Social" state="Low" duedate="4/09/2008"
isBranch="false"
> label="Meeting at 7pm" />
>
> <folder state="" isBranch="true" label="Home " >
>
> <folder cat="Home" state="High" duedate="3/09/2008"
isBranch="false"
> label="Pay power bill" />
> <folder cat="Home" state="High" duedate="3/09/2008"
isBranch="false"
> label="Pay rent" />
> <folder cat="Home" state="Low" duedate="3/09/2008"
isBranch="false"
> label="Call parents" />
> <folder cat="Home" state="Low" duedate="3/09/2008"
isBranch="false"
> label="Attend John birthday party" />
> <folder cat="Home" state="Medium" duedate="3/09/2008"
> isBranch="false"
> label="Special Updates" />
> <folder cat="Home" state="high" isBranch="false"
label="get Dr.
> appointment" />
>
> </folder>
>
> <folder state="" isBranch="true" label="Office " >
>
> <folder cat="Off" state="High" isBranch="false"
label="Meeting
> at
> 5pm" />
> <folder cat="Off" state="Low" isBranch="false"
label="Complete
> document and send to client" />
> <folder cat="Off" state="Low" isBranch="false"
> label="Interviews
> and Transcripts" />
> <folder cat="Off" state="High" isBranch="false"
label="Set
> Deployment
> machine" />
> <folder cat="Off" state="High" isBranch="false"
label="send status
> reports" />
>
> </folder>
>
> </folder>
> </todolist>
>
>
> MXML file............
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
> layout="absolute"
> initialize="adgService.send()">
>
> <mx:HTTPService id="adgService" url="adg.xml"/>
> <mx:AdvancedDataGrid
>
dataProvider="{adgService.lastResult.todolist.folder}">
> <mx:columns>
> <mx:AdvancedDataGridColumn headerText="Name"
dataField="label"/>
> <mx:AdvancedDataGridColumn headerText="Age"
dataField="state"/>
> </mx:columns>
> </mx:AdvancedDataGrid>
>
> </mx:Application>
>
> Thnaks & Regards
> edeewan
Try
<mx:AdvancedDataGrid
dataProvider="{adgService.lastResult.folder}"> -
Parsing XML Node with href attribute
Hi,
I have the following XML that has to be parsed using JSP DOM. All fine except for one. The only problem that i have is when to parsing the Node with href attribute.
I am using the following method, and it returned with weird result
currNode.getAttributes() ====> the result is com.sun.org.apache.xerces.internal.dom.AttributeMap@111ae04
currNode.getNodeValue() ====> the result is null
currNode.TextNode ===> it returned *2*
Can anyone please let me know what did I miss here? What should I do to parse the href attribute into the jsp page?
The below is the xml.
<MovieList>
<Movie href="DarkKnight.xml">
<head>
<Title>Batman Dark Knight</Title>
<Genres>
<Genre>Action</Genre>
<Genre>Sci-Fi</Genre>
</Genres>
<Description>Movie Details here</Description>
</head>
</Movie>
</MovieList>ThanksI am not sure what "JSP DOM" is exactly. In the W3C DOM supported since SUN Java 1.4 if you have an element node and want to access an attribute value you can simply use String href = movieElement.getAttribute("href"); You might need to cast your Node to Element first e.g.Element movieElement = (Element)currNode;
-
How to read an attribute of an xml tag in jsp.
hi guys,
This is murali krishna. i have a small problem,
i have one xml file (books.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<library>
<book id="1">
<name>Head First Java, 2nd Edition</name>
<author>Kathy Sierra and Bert Bates</author>
<publication-date>09-Feb-2005</publication-date>
</book>
<book id="2">
<name>Effective Java</name>
<author>Joshua Bloch</author>
<publication-date>28-May-2008</publication-date>
</book>
<book id="3">
<name>Java How to Program, 7th Edition</name>
<author>Harvey M. Deitel and Paul J. Deitel</author>
<publication-date>6-Jan-2007</publication-date>
</book>
</library>
I tried to read this xml file in jsp as shown below
<%@ page language="java" %>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="javax.xml.parsers.DocumentBuilder" %>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
<%
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db =dbf.newDocumentBuilder();
Document doc=db.parse("c:\\books.xml");
NodeList nl = doc.getElementsByTagName("book");
%>
<html>
<head>
<title>How to read XML file in JAVA</title>
</head>
<body>
<%
for(int i=0;i<nl.getLength();i++)
NodeList nameNlc= doc.getElementsByTagName("name");
Element nameElements=(Element)nameNlc.item(i);
String nameTagValue=nameElements.getChildNodes().item(0).getNodeValue();
NodeList authorNlc= doc.getElementsByTagName("author");
Element authorElements=(Element)authorNlc.item(i);
String authorTagValue=authorElements.getChildNodes().item(0).getNodeValue();
NodeList dateNlc= doc.getElementsByTagName("publication-date");
Element dateElements=(Element)dateNlc.item(i);
String dateTagValue=dateElements.getChildNodes().item(0).getNodeValue();
out.println("name :"+nameTagValue+"<br>");
out.println("author :"+authorTagValue+"<br>");
out.println("publication-date :"+dateTagValue+"<br><br>");
%>
</body>
</html>
so, my problem is I was unable to read the attribute of the tag book , that is "id".
can any one tell me how to read this "id" attribute.
Murali Krishna
[email protected]hi,
U r retriving the elements by tag name.So it just chks the tag name ie.<book> & gives u array of elements.But u need retrive d attribute of <book> tag itself.
=Solution =====
Add one more statement ----> var[]= doc.getElementsByName("book");
Now u hav book elements as an array & can retrive id in for loop
for(var; var.length;var++)
doc.element[var].id.value -
Populating Tree with External XML File
I want to use external files for populating Flex 3
components. I have been successful using code very similar to that
below for a data grid & for a combo box, but it won't work for
a tree. Can you determine wh?
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:HTTPService id="dp_Tree1" url="Tree1.xml" />
<mx:Tree dataProvider="{dp_Tree1.lastResult.root.node}"
creationComplete="dp_Tree1.send()" width="333"/>
</mx:WindowedApplication>
It's not working & I can't determine why. Attached is my
xml file that I tested it with.Thanks a bunch folks, but my intent is to have as little code
as possible. I want to help people who are not coders create
designs using external xml files to populate controls. I was able
to create very simple code with just two lines to populate a
DataGrid from an external xml file:
<mx:HTTPService id="dp_DataGrid1" url="DataGrid1.xml"
/>
<mx:DataGrid
dataProvider="{dp_DataGrid1.lastResult.component.rows}"
creationComplete="dp_DataGrid1.send()" />
And just two lines for a ComboBox:
<mx:HTTPService id="dp_ComboBox1" url="ComboBox1.xml"
/>
<mx:ComboBox
dataProvider="{dp_ComboBox1.lastResult.component.rows}"
creationComplete="dp_ComboBox1.send()" />
Isn't it possible to populate a tree with two lines like as
it is with a DataGrid & ComboBox? -
Char into balise jsp:scriptlet in jsp with xml syntax
hello,
i met a trouble with coding jsp with xml syntax,
i use wsad to develop the jsp, and it's not allowed to put characters < or > into the balise scriptlet
for example i cant do a loop (as i did easily with html syntax <% %> ) :
this his the header of my jsp:
<jsp:directive.page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" />
<jsp:text>
<![CDATA[ <?xml version="1.0" encoding="ISO-8859-1" ?> ]]>
</jsp:text>
<jsp:text>
<![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ]]>
</jsp:text>
and the code which dont work:
<jsp:scriptlet>
for (int i=0;i<10;i++){
System.out.println(i);
</jsp:scriptlet>
i get a compilation error, did someone could help me to code dynamic content jsp ?
ps: excuse me for my english.I don't use xml, so I may be way off the wall, but did you try using the CDATA sections again?
<jsp:scriptlet>
<![CDATA[
for (int i=0;i<10;i++){
System.out.println(i);
]]>
</jsp:scriptlet> -
JSP 2.0 Tag files outputting elements with conditional attributes
It appears to be impossible to conditionally output element-attributes in JSP 2.0 XML Tag files. Here's an example:
Tagfile text.tagx:
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
<jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
<jsp:text>
<input type="text" name="${name}" id="${id}" />
</jsp:text>
</jsp:root>Seems simple enough. This tag has a name-attribute and an optional id-attribute. But what if I want the id-attribute of the 'input' element not to be outputted when the id-parameter is empty!
It appears there's no elegant way to do this but to revert to CDATA blocks and/or output-escaping. Is this an oversight in the API or am I missing something?
I've also tried the following but it didn't work (in Tomcat anyway):
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2" xmlns:c="http://java.sun.com/jsp/jstl/core">
<jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
<jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
<jsp:text>
<jsp:element name="input">
<jsp:attribute name="type" value="text"/>
<jsp:attribute name="name" value="${name}"/>
<c:if test="${!empty id}">
<jsp:body>
<jsp:attribute name="id" value="${id}"/>
</jsp:body>
</c:if>
</jsp:element>
</jsp:text>
</jsp:root>Any ideas on how to do this?I wonder why no one has responded to this post!!!! I am trying to do the same thing, to no avial. In XSLT this is how it works, I would have thought JSTL would do the same thing. D'oh!
Maybe you are looking for
-
Criando campo layout em um programa
Bom dia pessoal, estou desenvolvendo um relatório e estou precisando colocar um layout para mostrar o relatório com os campos de acordo com o que o usuário deseja, estou utilizando a principio a função 'REUSE_ALV_VARIANT_F4' para buscar os layouts já
-
Moving a table with long data type column
hi 1.how to move a table with a long data type column in 8.1.7.3.0 ver database. alter table APPLSYS.FND_LOBS_DOCUMENT move lob(BLOB_CONTENT) store as (tablespace testing) ERROR at line 1: ORA-00997: illegal use of LONG datatype 2. and a table with v
-
I logged in to iCloud to pay for backup storage. I clicked on the 20GB option for $40, then changed my mind and clicked on the $100 for 50GB storage space. I thought the $100 50GB would over ride the $40 for 20GB, but I got charged for both. How do I
-
How to pan using magic mouse in Autocad 2012 for Mac?
Hi. I'm loving Autocad 2012 on my Macbook Pro Retina (although, it is not yet supporting Retina Display). The problem is, I want to be able to pan using magic mouse but, there seems to be no option for this. If I use two finger swipe, it switches bet
-
System preferences's not working
system preferences wont open anymore, says that i cant open it because it may be damaged or incomplete