XML syntax

I've tried to write several simple pages using the XML syntax, but I can't solve the following problem. I have a form, where I want to prefill some values (for example the values filled in before), but I'm not able to do this using the XML syntax. Using classic JSP syntax it looks like
<input type="text" name="firstName" value="<%=formHandler.getFirstName()%>">
But in the XML syntax
<input type="text" name="firstName" value="<jsp:expression>formHandler.getFirstName()</jsp:expression>">
the compiler still complains:
index.jsp [39:-1] Use "<" for "<" in attribute values.
I'm sure it's pretty trivial, but I still can't solve it. I've tried several ways to escape the lt, gt signs, but that doesn't work for me.

Hello FuzzyMac,
In this special case, you might use EL (expression language) from JSP 2.0 (of course this might only be an option for non-production developing); in this case it might look like:
<input type="text" name="firstName" value="${formHandler.getFirstName()}">You second example is not XML valid, because it uses also nested elements (< and > within an attribute is not allowed).
Please have a look to an intorduction here on java.sun.com on JSP 2.0 where they explain wrinting .jspx files without EL; that might also apply to JSP 1.2 (sorry do not have the link, just search for JSP 2.0).
Greetings, Timo

Similar Messages

  • XML syntax error in a JSP page.

    Hi,
    i was trying to include xml syntax in a jsp page in stead of core jsp syntax. it didn't work.But the jsp document with the core jsp syntax works. I'm wondering what's the problem.any help would be really helpful. I'm using Tomcat 3.2.1.
    Thanx in adv,
    Ganesh
    JSP file - NOT WORKING
    <jsp:directive.page import="java.util.Date"/>
    <jsp:declaration>
    private static String loadTime = new Date().toString();
    private static String getLoadTime() { return loadTime; }
    private static String getCurrentTime() { return new Date().toString(); }
    </jsp:declaration>
    <HTML>
    <HEAD><TITLE>XML and JSP</TITLE></HEAD>
    <BODY>
    JSP page is created using XML syntax...<BR>
    This page was loaded into memory at <%= getLoadTime() %>.<BR>
    The current time is <%= getCurrentTime() %>
    </BODY>
    </HTML>
    ERROR :
    Error: 500
    Location: /test/declarations.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\tomcat321\tomcat\work\localhost_8080%2Ftest\_0002fdeclarations_0002ejspdeclarations_jsp_6.java:59: Method getLoadTime() not found in class _0002fdeclarations_0002ejspdeclarations_jsp_6.
    out.print( getLoadTime() );
    ^
    C:\tomcat321\tomcat\work\localhost_8080%2Ftest\_0002fdeclarations_0002ejspdeclarations_jsp_6.java:65: Method getCurrentTime() not found in class _0002fdeclarations_0002ejspdeclarations_jsp_6.
    out.print( getCurrentTime() );
    ^
    2 errors

    Hi,
    any help on this question would be really appreciated..
    Thanx in adv,
    Ganesh

  • Standard or XML syntax?

    Which syntax is more "trendy"? And what's so special about XML syntax? All the fuss about the <jsp:text> and CDATA when writing output... And what does the jsp:text do in the first place? I read it preservs whitespace, but I didn't see the difference. And why is ${expression} said to be invalid in the J2EE tutorial? Sorry if these are funny questions but I'd really like to know it :-)

    You can find lots of example in this forum.
    Here are some of the recent ones:
    xmlp conditional region if statement inlist
    choose when syntax

  • XML  syntax for  MULTI checkboxes

    Another XML question :
    how do I indicate multi-checkboxes?
    Meaning, instead of ticking one box, you can tick several boxes for the same field/attribute?
    Example :
    *<Field name='WhatKindOfGuy'>*
    *<Display class='???????'*
    *<Property name='Title' value='What kind of guy is Michael?'*
    Let's say I want to present a variety of options : *(a) Cheerful (b) Friendly (c) Openminded (d) Ambitious (e) Dedicated (f) Brash,* etc, etc,etc
    Obviously, Michael can be several of these things.
    So, I want to have several checkboxes.
    What's the correct XML syntax?

    In your case u have to take that many checkboxes, and finally evaluate the checkboxes selected or not on the basis of their values is true or false

  • XML syntax to revoke all the AccessControlEntry

    Hi all!!!
    I would like to know if there is an XML syntax to revoke all the AccessControlEntry of an ACL
    Thanks

    Fran wrote:
    do you know the different between PRIVATE and PUBLIC Synonym?
    Public synonyms are accessible to all users.
    Private is accessible only within its schema.
    if you don't want that this user, uses this synonym drop it and create a private synonym in the others schemas where the users need it.That doesn't fix the privilege issue though. The user can still access the table by prefixing the table with the schema name.
    You need to find out who granted the privileges on that table to the user (ie which schema) and then revoke all the privileges that were granted to that user.
    Log in as the user and execute :
    select * from user_tab_privs
    where table_name = 'YOURTABLENAME'or
    select * from dba_tab_privs
    where grantee = 'YOUR USER THAT YOU WANT TO REVOKE PRIVILEGES FROM'
    and table_name = 'TABLE_NAME that you want to revoke privileges from'Edited by: Keith Jamieson on Dec 21, 2012 2:16 PM

  • XML Syntax Highlighting

    Hi, I need help with XML Syntax Highlighting. I try to create simple XML editor, but I have probleblems with Syntax Highlighting.
    Is there anyone who can help me?

    Here is personal recommendation, this 3rd party syntax highlight component works quite well for many JTextComponents
    Check out: http://ostermiller.org/syntax/
    ICE

  • XML Syntax highlighting (again :)

    Hi there,
    I know, that there have been quite a view posts about this topics, but as far as I see, there has been no solution to this.
    So I wanted to ask if someone has implemented a XML Syntax highlighting or knows where to get a tutorial from to accomplish so (inheriting from DefaultStyledDocument...?)
    Sincerely
    Charly

    Hi!
    I have the same need: an XML Syntax Highlighting (coloring).
    I don't need an XML editor, I have a JTextPane that shows XML code and I would like it to be done with a syntax coloring.
    If you have a solution I will really appreciate!
    Thanks
    Gio :-)

  • 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>

  • Mixing XML syntax w/JSP syntax

    As I understand it, you can use either the JSP-specific syntax or an XML-based syntax for code in a JSP page. For instance you can use either
      <%= expresssion %>(JSP-specific syntax)
    or
      <jsp:expression>
        expression
      </jsp:expression>(XML-based syntax)
    to do much the same thing. But I think once I heard somewhere that the two syntaxes cannot be mixed on the same JSP page. Two questions about that:
    (1) Is it true?
    (2) If it is true, what about a page of one syntax that includes (using include directive) a page of the other syntax -- there will be inconsistency here.
    Thanks if you can answer this.

    A jsp source file(.jsp) should be in either Xml syntax or Jsp syntax.

  • IMG tag and XML syntax

    Hi,
    I want to dynamically embed image url into the IMG tag as follows:
    <jsp:useBean id="image" scope="request" class="mybeans.ImageBean" type="mybeans.ImageBean" />
    <img src='<jsp:getProperty name="image" property="imagePath"/>'    />The problem arises because of confusion with closing/opening tags getting mixed up.. How do I get this code to work if i'm using xml syntax in my jsp pages? Any solutions?
    P.

    It would be complaining about using a tag as an attribute to another tag.
    ie nesting a tag within the tag, rather than between open/close tags for it.
    Solution? Don't nest tags like this. I'm figuring you have to use an expression of some sort.
    either <img src='<%= image.getImagePath %>'/>
    or using EL in a JSP2.0 container:
    <img src='${image.imagePath}'/>
    I can't say I have done strict xml stuff, so I might be a little off, but thats the general idea.
    Hope this helps,
    evnafets

  • XML syntax for tags

    It has always been a habit of mine to use XML syntax for CF tags since I've been working with XHTML. For instance, I will do <cfset var myVar = "" /> However, I noticed when doing <cfdump var"#myvar#" />, the output is displayed twice. So now I am wondering if whenever I use a /> on something such as cfset, is the tag actually executing twice? How does this affect performance?
    I just happened to notice that in CFBuilder, when I do <cfargment name="myVar" required="true" type="string" default="" />, when I go to the next line and start typing <cfarg auto-suggest will select the cfargument tag, but this is only if I use a />. If I omit the ending forward-slash, auto-suggest does not work. That may be a setting specific to CFBuilder, but that wasn't the scope of this question.
    What syntax is correct and how does it affect performance?

    According to the document I've linked to below; using self-closing CF tags, such as <cfset myname="Bob" /> is permissible.  The document also notes exceptions to this such as CFIF and custom tags as examples where a self-closing tag shouldn't be used.
    http://livedocs.adobe.com/wtg/public/coding_standards/style.html
    Althoguh it doesn't look like it, that's an internal coding standard for one of Adobe's (well: it was Macromedia at the time) internal teams, and is not supposed to be a suggested standard for everyone.  I've had this same discussion with them, too.
    As Owainnorth (and many others) observe, it's completely doable.  My only challenge to it (and it's a challenge I state in an unduly heavy-handed fashion sometimes!) is the nonsensical rationales people use for doing it: making it more like XML, it's good if the CFML blends in better with the XHTML mark-up it's generating, it's tidier, etc.
    I hasten to add that Owainnorth's position that he finds it easier to read and assists with code navigation, whilst leaving me with a blank look on my face, is a completely reasonable basis for doing it.  I personally don't believe it, but there's no reason why that should bother him (and I'm sure it doesn't).
    I think it was reasonable of me to challenge his wording that it's easier to identify where CF code blocks are by looking at the closing slash rather than the tag name; but having explained himself better, I reckon it's not quite so much tosh as it originally sounded.  I mean: I still can't see it, but obviously he can, so fair enough.
    Adam

  • XML syntax error 1084

    Hi,
    this is my first post on the forum and I'm a new to Flash.
    I got an error which I can't seem to figure out on my own what is the problem, I've read through some of the 1084 errors but still couldn't figure it out
    I got "1084: Syntax error: expecting rightparen before colon" on this line: myXML = new XML(e:target.data);
    And here is the whole code:
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE,onLoaded);
    var myXML:XML;          // Variable to hold XML class
    function onLoaded (e:Event):void{
    myXML = new XML(e:target.data);
    loader.load(new URLRequest("names.xml"));
    trace(myXML);
    Thanks in advance
    Regards Sakujin

    I've discovered the error after I got help from a friend the culprit was a colon instead of a punctation after XML(e.target.data); instead of XML(e:target.data)
    Thanks for everyone that has visited my post.

  • XML Syntax Error

    I have a page with NO comments that output unicode in xml and
    sometimes it works, sometimes it says:
    Incorrect syntax was used in a comment. Error processing
    resource '
    http://www.netspeaknow.com/gamers/flashCFM/getPopQuiz.cf...
    <!-- "
    ---></TD></TD></TD></TH></TH></TH></TR></TR></TR></TA...
    but there are no comments. Even if there were why would this
    page only work about half the time? I have attached the code.
    Thanks for any help!

    Try wrapping all your code in <cfsilent>, and move you
    <cfcontent> down to
    the same line you're outputting your XML (ie: at the bottom).
    XML gets antsy if there is whitespace before the
    <?xml?> tag, or between
    that and the doctype (in my experience).
    I'd alos SERIOUSLY consider refactoring your approach to
    writing code so
    that you don't have a mix of processing, function
    declarations, DB calls
    and output all in the same CFM template. It's a bit of a
    mess.
    Also make sure you VAR all your variables in functions, and
    use
    <cfqueryparam> tags in your queries. Read up on when to
    use pound signs
    (and when not to), and when to use <cfoutput>.
    You only need pageencoding="UTF-8" on your template if the
    actual code has
    UTF-8 characters in it: it doesn't matter if the DATA you're
    processing is
    UTF-8; the <cfprocessingdirective> tag is a compiler
    instruction, not a
    ruuntime one. Otherwise it's just noise (cue: Paul Hatings
    disagreeing
    with that ;-)
    Adam

  • Migapp.xml syntax to include Firefox 10* in USMT

    I am currently using USMT and Microsoft Deployment Toolkit to upgrade/deploy Windows7. My efforts to include Firefox 10* in the migapp.xml have been unsuccessful. It refuses to capture the Firefox data. I am sure it's a syntax issue. It works for version 4, eg: <!-- Mozilla Firefox 4 -->
    <component context="UserAndSystem" type="Application">
    <displayName _locID="migapp.firefox4">Mozilla Firefox 4</displayName>
    <environment name="GlobalEnv"/>
    <environment name="GlobalEnvX64"/>
    <role role="Settings">
    <detection>
    <conditions>
    <condition>MigXmlHelper.DoesObjectExist("Registry","%HklmWowSoftware%\Mozilla\Mozilla Firefox 4.*\bin [PathToExe]")</condition>
    </conditions>
    </detection>
    <rules context="User">
    <destinationCleanup>
    <objectSet>
    <pattern type="File">%CSIDL_LOCAL_APPDATA%\Mozilla\Firefox\Profiles\*\Cache\* [*]</pattern>
    </objectSet>
    </destinationCleanup>
    <include>
    <objectSet>
    <pattern type="File">%CSIDL_APPDATA%\Mozilla\Firefox\* [*]</pattern>
    <pattern type="File">%CSIDL_LOCAL_APPDATA%\Mozilla\Firefox\Profiles\* [*]</pattern>
    </objectSet>
    </include>
    <exclude>
    <objectSet>
    <pattern type="File">%CSIDL_APPDATA%\Mozilla\Firefox\Crash Reports\* [*]</pattern>
    <pattern type="File">%CSIDL_APPDATA%\Mozilla\Firefox\Profiles\*\ [pluginreg.dat]</pattern>
    <pattern type="File">%CSIDL_LOCAL_APPDATA%\Mozilla\Firefox\Profiles\*\Cache\* [*]</pattern>
    </objectSet>
    </exclude>
    <merge script="MigXmlHelper.SourcePriority()">
    <objectSet>
    <pattern type="File">%CSIDL_APPDATA%\Mozilla\Firefox\* [*]</pattern>
    <pattern type="File">%CSIDL_LOCAL_APPDATA%\Mozilla\Firefox\Profiles\* [*]</pattern>
    </objectSet>
    </merge>
    </rules>
    </role>
    </component>

    A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.<br>
    You need to register at the MozillaZine forum site in order to post at that forum.

  • JSP xml syntax, taglibs not found

    Hello,
    I have JSPs look so:
    <?xml  version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE jsp:root [
    <!ENTITY nbsp "&#x00A0;">
    ]>
    <jsp:root version="1.2"
              xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns:afc="http://afclabs.com/tags/afc"
              xmlns:c="http://java.sun.com/jstl/core">
    <jsp:directive.page language="java" contentType="text/html; charset=iso-8859-1"/>
    <afc:page>
    <head>
    <title></title>
    </head>
    <body>
    </body>
    </afc:page>
    </jsp:root>[/code:1:449443877c]
    If I use Tag Libraries panel, to insert , for example <c:out> tag, then the tag will be inserted along with this line: <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>, like so:
    [code:1:449443877c]<?xml  version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE jsp:root [
    <!ENTITY nbsp "&#x00A0;">
    ]>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <jsp:root version="1.2"
              xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns:afc="http://afclabs.com/tags/afc"
              xmlns:c="http://java.sun.com/jstl/core">
    <jsp:directive.page language="java" contentType="text/html; charset=iso-8859-1"/>
    <afc:page>
    <head>
    <title></title>
    </head>
    <body>
    <c:out value="test" default="test"/>
    </body>
    </afc:page>
    </jsp:root>[/code:1:449443877c]
    I don't need this line, because the tag libraries are defined in the <jsp:root> tag.
    How can I stop the automatically insert of this line ?
    How to make, that the Nitrox "undestand" this tag:
    [code:1:449443877c] <jsp:root version="1.2"
              xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns:afc="http://itoolabs.com/tags/afc"
              xmlns:c="http://java.sun.com/jstl/core">[/code:1:449443877c] ?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    http://java.sun.com/products/jsp/docs.html
    To my knowledge, only Tomcat 5 will use the 2.0 specs. Other servers will use the 1.2 spec, but the server docs should state which JSP spec they support.
    I found the 'Card' PDF the most helpfull. The 'Reference' is quick and easy, but you don't get as much info as quickly, IMO (for example I couldn't find the information to help here in the 'Reference' but it was right on top in the 'Card')

Maybe you are looking for

  • Office 2013 license pack does not allow me to activate key within configuration wizard

    Hello,  I have a KMS host running Office 2010 activations for our client computers which is running fine. I installed the Office 2013 license pack on the same host. However, in the configuration wizard it doesn't allow me to activate the product key.

  • Error when burning data dvd after installing 7.3.2.6

    Making a data backup of a playlist of about 400 songs. Around 6 songs have the exclamation point with the error message "The song could not be used because the original could not be found. Would you like to locate it?" I located the originals and the

  • Multiple schema, but instance doc does not have namespace

    Is it possible to successfully validate an instance document without namespaces against multiple schema with different namespaces? example: this is the normal xml which is valid with all the namespace: <MyRoot dateTime="040112061834" instanceIdentifi

  • Consistently need a hard reset when re-plugging power.

    Each time I unplug power to my TC neither of my macbooks will recognize the TC. The only procedure that seems to work is to do a hard reset of the TC while plugging the power back in. Must I do this every time I unplug the power to the TC?

  • Dial a phone number from iTunes

    I am searching for a way to dial a number either from within iTunes, or from Outlook directly, that would be really practical.