Java EE 5 Tutorials Examples...Explanation Needed

Hello There
Iam Reading Sun Java EE 5 Tutorials For JSP
And I've Reached The Lesson:The Example JSP Pages
But When I Got To The Code,I Couldn't Understand Anything?
Is There's A Further Explanation For The Code,Or It Depends On Earlier Lessons?
Or How Could I Understand It?
Someting Like That?
bookstore.jsp
<p><b><fmt:message key="What"/></b></p>
<jsp:useBean id="bookDB" class="com.sun.bookstore2.database.BookDB" scope="page" >
  <jsp:setProperty name="bookDB" property="database" value="${bookDBAO}" />
</jsp:useBean>
<jsp:setProperty name="bookDB" property="bookId" value="203" />
<p>
<c:url var="url" value="/books/bookdetails" />
<blockquote><p><em><a href="${url}?bookId=203">${bookDB.book.title}</a></em>,
<c:url var="url" value="/books/bookcatalog" />
<fmt:message key="Talk"/></blockquote>
<p><b><a href="${url}?Add="><fmt:message key="Start"/></a></b>

BalusC wrote:
It's hard to understand you since you start every word with an uppercase. Where have you learnt writing English that way? This childish way of writing is fairly annoying to read and it is likely to generate less response at the public forums.I thought he needed help on jsp example rather than on his poor english :P

Similar Messages

  • Good Java XPath Resources / Tutorials

    Anyone have any good resources / tutorials for XPath in Java? I've been playing with XML in java for the past two days and have found it Math.pow(convoluted, 100). What I'm basically looking for is the equivalent of this C#:
    using System;
    using System.Xml;
    using System.Xml.Xsl;
    class Test {
       static void Main( string[] argv ) {
          XmlDocument xml = new XmlDocument();
          xml.Load(@"c:\database_mapping.xml");
          foreach( Node n in xml.SelectSingleNode("/database[@name='TEST']/table[@name='VEHICLES']").ChildNodes ) {
             // process each node
    {code}I've played around with the javax.xml.xpath package and have found it to be all but useless.  The *best* I've been able to do is find the value of a given node with a compiled XPath expression.  I need it to actually retrieve the Node object from an XML Document (be it from an org.w3c.Document or one of the billions of other possibilities that seem to be available).
    Along those same lines, I have discovered that there are dozens of XML packages in java.  Is this a mix-and-match kinda thing?  Is there one standard package?  I've not found a useful Java XML tutorial, either.  I've tried googling, assuming that Sun would have a nice Java XML tutorial, but googling "java xml tutorial" returns this result:
    Java XML Tutorial
    "This is Sun's tutorial, Working with XML - The Java API for XML Parsing (JAXP). Provides a manual designed to quickly write XML code and XML-based software ..."
    When following the link, you get to: http://java.sun.com/webservices/
    which is certainly not a Sun Tutorial.
    I'm sure that this has got to be more simple than it's being made out to be.  Certainly Microsoft was not capable of creating an infinitely better and more efficient method for parsing XML... someone, please tell me I'm wrong.  Please. :-)
    Thanks for your help!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    DrClap wrote:
    Sun (in its infinite wisdom) decided it would be a good idea if you could plug in your own preferred parser and serializer and transformer, so they designed JAXP as a pluggable architecture. Microsoft (as usual) didn't mess with any of that, they just buried those things in their infrastructure. So you don't have any of those annoying choices to make with Microsoft.
    Actually you don't have to make any annoying choices with JAXP, either. You just ignore the whole pluggability thing and use the components that are already included in Java.
    And yeah, there used to be decent Java XML tutorials out there, but lately they have disappeared and been replaced by less focused tutorials, as you found. The second link that Google gives me is this one: [Java API for XML Processing|http://72.5.124.55/j2ee/1.4/docs/tutorial-update6/doc/JAXPIntro.html] -- although it seems to be abandoned, Google still knows the IP address of the server.
    Thanks for the clarification and for the tutorial. I saw the link but passed over it as it didn't provide a domain ... didn't know that it actually belonged to Sun.
    The tutorial is good; I was able to skim through it and all seems pretty straight forward. It does appear, though, that what I want to do isn't possible in java. (The only example it gave of "searching for a node" was a custom implementation of traversing every single node* in the DOM hierarchy.
    ... this is discouraging ...
    Thanks again, though, for your help. It was much appreciated.

  • How can I get the java 2D java2D  tutorials�H

    How can I get the java 2D java2D tutorials which I dont need lookup it online?

    The download link for all the Java tutorial is here:
    http://java.sun.com/docs/books/tutorial/

  • Webdynpro ABAP & JAVA step by step example

    hi experts,
    i am new in webdynpro. i want to learn webdynpro so any one plz help me how to create,how to install,connect,and how to execute plz send any documents for webdynpro ABAP & JAVA step by step examples with screen shots.it's really helpful for my carrier.
    thanks and regards,
    sapbbm.

    Hi Bala,
    Go through the below link,
    https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/fed073e5-0901-0010-4eb4-c9882aac7b11 [original link is broken]
    Here u can find 6 tutorial applications on Webdynpro Abap with step by step procedure, Using this u can start of with Webdynpro from the basics.
    Along with this u can find good documentation in,
    http://help.sap.com/saphelp_erp2005/helpdata/en/f6/501b42b5815133e10000000a155106/frameset.htm
    Hope this helps,
    Regards,
    Sachidanand.B

  • Webdynpro ABAP & JAVA step by step example with screen shots

    hi experts,
    i am new in webdynpro. i want to learn webdynpro so any one plz help me how to create,how to install,connect,and how to execute plz send any documents for webdynpro ABAP & JAVA step by step examples with screen shots.it's really helpful for my carrier.
    thanks and regards,
    sapbbm.

    hi bala,
      check out this URL you have 41 sample codes and PDF of Webdynpro for JAVA.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d
    Thanks
    Gopi

  • If RuneScape uses Java 3D why don't you need to install it?

    I was just wondering if RuneScape uses Java 3D, why doesn't anyone need to install it? Is it because the game is intirely server side and all the graphics and stuff is done over on their servers and not on your own computer? Thanks.

    Most likely, you have a web plugin that depends on the Java runtime distributed by Apple, such as the Facebook video calling plugin or the "NexDef" plugin for watching baseball streams. If you no longer need the plugin, remove it, including its automatic update mechanism (if any) according to the developer's instructions. Otherwise, install Java.

  • Error initializing Java Runtime Environment.  You may need to reinstall Flash.

    ...This is really annoying.
    I work with adobe cs5. Recently, it started to not work. I would have to restart it over and over to get it to compile an swf properly. So I am trying cs5.5. I get this error "Error initializing Java Runtime Environment.  You may need to reinstall Flash."
    So im like OK....Thats helpful....
    -reinstalls flash-
    "Error initializing Java Runtime Environment.  You may need to reinstall Flash."
    -reinstalls java-
    -reinstalls flash-
    -reinstalls adobe flash cs5.5-
    "Error initializing Java Runtime Environment.  You may need to reinstall Flash."
    -google-
    So I come across this post. Follow it exactly.
    "Error initializing Java Runtime Environment.  You may need to reinstall Flash."
    I change the thingy in the file to Xmx1024M
    "Error initializing Java Runtime Environment.  You may need to reinstall Flash."
    I come to the forums.
    What do I do now?

    Intro:
    Finally I got near to roots of that mysterious Error
    "Error initializing Java Runtime Environment.  You may need to reinstall Flash."
    So here is what I'm found out + Bugfix
    JavaPatch for Adobe Flash CS5 / CS6...     Ver #1 [ 21.01.2014 ]
    ======================================
    This is the fix the bug in Flash tell you all the time that
    Java could not be loaded. The effect of this error is that
    Actionscript will not work.
    Flash gives a little misleading error messages that tells you that
    "There is no Actionscript in the current Project"
    background information:
    The problem is that the Java Virtual Machine.dll demands on startup
    250MB huge contiguous memory blocks, but the 2GB-Virtual address
    space of the Flash.exe process is already filled with various loaded dll's
    BEFORE you continue ensure that you install/copied JRE 1.8.0 update 31 to
    %ProgramData%\Adobe\CS5\jre\
    For testing check if ...Adobe\CS5\jre\bin\java.exe starts
    (and shows a help about available commands)
    The Patch is for 32-bit version only!
    (however the problem is probably not in the 64-Bit Version - since there a process has a much large more 'space')
    Well SIMPLE FIX / Workaround:
    Use 64-Bit version of Adobe Flash !
    TechDetails:
    Java's JVM.dll loaded in Ollydebug -  The patched / change bytes are red.
    ^-Note that String ASCII "NUMA page alloc..." - will be a great 'link' to easily find that location in other JVM-versions to applied the patch there. Open jvm.dll in Ollydebug open String Ref. Windows and search for the string...
    Download instructions:
    Right click on picture above and download it.
    Drag/open  the *.jpg in / into Winrar / 7-Zip 
    OR
    Rename 'Flash-CSX-jvm-JavaPatch #1.7z.jpg' -> 'Flash-CSX-jvm-JavaPatch #1.7z' so you open it by doubleclick
    -> My creative solution for that A-Dope-board missing 'Attach file feature'
    Tested:
    with Adobe Flash CS5 + JRE 1.8.0 update 31
    More Techstuff:
    Some of my notes that might be useful:
    Note the memory is not real allocated in the way it can be use since to write or read from it is just allocated as
    MEM_RESERVE like you see in the screenshot above. And freed just a little alter.
    It seems that java just checks if it could possible the maximal the JVM is made for.
    Note the problem is not that you have to less physical RAM installed.
    It's more related how memory is organise.
    Well in 32 Bit each process has 4GB (or well practically Windows limits this to 2GB).
    0x00000000 to 0x7FFF0000
    This space is virtual and not actually claimed (else you would very quickly run out of RAM) but it a kind of potential or Adress system. Na sorry that'll be to offtopic to explain all the basic's about memory.
    Adobe Flash CS5 calls
    jvm.dll!JNI_CreateJavaVM( OUT **p_vm, OUT **p_env, IN *vm_args);
    The 'vm_args'
    typedef struct JavaVMInitArgs {
        jint version;  00010004
      1. /* user classes */
      -D java.class.path=
      C:\Program Files\Adobe\Adobe Flash CS5\Common\Configuration\ActionScript 3.0\;
      C:\Program Files\Adobe\Adobe Flash CS5\Common\Configuration\ActionScript 3.0\asc_authoring.jar;
      C:\Program Files\Adobe\Adobe Flash CS5\Common\"...
      2. /* set native library path */
      -D java.library.path=
      C:\ProgramData\Adobe\CS5\jre\bin
      3.
      -D java.Home=C:\ProgramData\Adobe\CS5\jre
      4. classpath append
      -X bootclasspath/a:
      C:\Program Files\Java\jdk1.7\jre\lib\ext\QTJava.zip
      5. Headless mode is a system configuration in which the display device, keyboard, or mouse is lacking. Headless mode support has been available since the J2SE 1.4 platform.
      -D java.awt.headless=true
        jboolean ignoreUnrecognized; 1
    } JavaVMInitArgs;
    So for any further exploration about this Java problem setting a breakpoint to 'JVM.dll!JNI_CreateJavaVM' will be a great startpoint

  • I have recently purchased the latest ipad. Got to say I am extremely dissapointed that it does not support Java or Flash which are platforms needed to do online business banking. I am now faced with ditching it and replacing it with a competitors product

    I have recently purchased the latest ipad. Got to say I am extremely dissapointed that it does not support Java or flash which are platforms needed to do online business banking. I am now faced with ditching an expensive toy for a competitors product that offers full business functionallity. Is there any way round this ? It seems extremely bad form on apples part not to support this or make it very clear of the products limitations at the time of purchase.

    Well, my bank has an app but the website does not use Flash or Java.  While my credit union doesn't have an app, their website doesn't require Flash or Java either.
    I pay all my bills online, bank, and access my brokerage accounts.  None of the sites I have encountered require Flash or Java.  Some government sites do require Flash so I use Photon, it's a browser that does Flash content very well.  So you might check out some alternatives browsers.
    Otherwise I suppose you will either dump you bank, your iPad, or just not do online banking. 

  • Searching for tutorials/examples

    Hello,
    are there any tutorials/examples for
    toplink + Jdeveloper (10.1.3) + swing/adf clients?
    (no web-, no ejb-apps)
    Greetings.

    There are several Oracle By Example (OBE) tutorials and demos available at: http://www.oracle.com/technology/obe/obe9051jdev/index.htm and http://www.oracle.com/technology/products/jdev/index.html.
    Specifically, there is: http://www.oracle.com/technology/obe/obe9051jdev/ToplinktoDatabinding/toplinktodatabinding.htm that explains how to Developing a J2EE Application using TopLink, Struts, JSP and ADF Databinding.

  • .java to .class - what do I need - URGENT

    I do not know java at all.
    I need something to compile .java files to .class files.
    A standalone program would be great (Windows XP)

    You need, of course, the jdk. Go to java.sun.com and download the jdk (follow the jse links). While you are there go through all the basic tutorials before coming back with another question.
    Also, do not mark a post as urgent. It only turns people away. It is not urgent to them. They are reading and answering these posts on their own time. Also, before posting a question, use the API documentations, the Sun tutorials, and Google generously before you post a question. When you then do post a question, tell us clearly and concisely what the problem is, and what you have already done to try and solve. Then include an example code that is small, and reproduces the problem. Doing this last step, will many times allow you to solve the problem yourself.

  • Help/explanation needed - Using an external hard drive

    Hi everyone,
    I bought an external 250gb hard drive as my MBP was very close to full capacity. Yesterday, I had a bit of a scare...
    1. I backed up my Aperture Library onto the external hard drive.
    2. I had about 500 of my favourite images rated 5 star and so I selected these and set up a new project.
    3. I went through my Aperture library deleting folders/projects that I have completed.
    4. I went back into the 5 star ratings and they did not exist. I assume this is because I deleted the master files.
    5. I wanted to have the 5 star images on my laptop and so I connected my external hard drive once again. [This is where I felt I lost control and understanding of what was going on].
    6. I looked for the seperate Aperture files but could only find a file called Aperture Library. I clicked on this but nothing happened at all [I had thought that it would open up Aperture with the previous library].
    7. I dragged the library onto my desktop and waiting for all the images to reload onto my laptop. I then saw that everything was as it was previously, i.e. all the files and images existed. However, my hard drive space was even lower [I assume this was because the current workflow that I had left on the laptop was now duplicated?].
    8. Then I got a message saying my iDisk space is critically low and may damage my Aperture library. Moments later the majority of my images disappeared and a red space appeared where every photo had previously been. Since I have 2 weddings that I am yet to deliver I was very panicked. I tried to drag and drop the Aperture library once again and the message came back that the operation could not be completed due to the current file already existing.
    9. I unplugged the external hard drive and the photos re-appeared [much to my delight]. However, my concern is that I really don't understand what happened and more importantly why. I will need access to the data on the external hard drive in the event in the near future and am worried that the same thing will happen next time I connect it.
    As a result of all this I have some questions, as follows:-
    - Have I adopted the completely wrong approach to backing up data?
    - Can the master files be compressed as I shoot RAW and these are huge files?
    - Why could I not use the Aperture library stored on the external hard drive without downloading it back onto the laptop?
    and a more general question about file storage...
    - I am confused as to how much hard drive space is being used on my MBP. I have 13gb in Aperture, 1gb in iTunes and 1gb in iPhoto. However, I only have 50gb available, so half the capacity is currently being used. I know that Aperture and Garageband applications use about 10gb between them and there is of course the operating system, but 50gb in total seems a lot. On investigation in the finder screen I see that on my personal drive the Aperture, iTunes and iPhoto data is stored there. However, it is also stored under pictures and music respectively. Does this mean that it is storing duplicate copies of this data and that is the explanation for such high hard drive usage? If this is the case, can one be removed?
    I appreciate that this has been a long email, but I felt it was important to illustrate the steps I have taken. As you will no doubt glean from this post I am not the most computer literate person. Any help/explanation would be most appreciated.
    Many thanks,
    Jamie

    Hi Jamie.
    I am not sure what went wrong with your setup but I will let you know my configuration as an example and you can decide if you think it is a good way to have it. I am asuming you are using ver 1.5?
    Like you I have only a Laptop (G4 17" 1.5Ghz 2 Gig Ram - would love a macbook) so hard disk space is a premium. I also have an external firewire drive to hold all the HiRes RAW images. When I download my images from the Camera I do it manually into folders on the external drive (Cataloged by Date and maybe description of location). I then Import the images from those folders into Aperture but use the option when importing to "Store Files - In their current location".
    My Aperture library file is on my laptop so all that it has to store is the "Preview" file that gets generated automatically (in the preferences I have it set up to the resolution of my laptop 1440pix so that if I did a slide show it is only as big as my screen - anything more is a waste of disk space IMO.)
    I do it this way so that it is easy to find and work on my files with other programs such as Photoshop by going straight to the image rather than exporting from Aperture.
    Obviously I cant edit the RAW files while the drive is disconnected but I can still do ratings and keywords without the original files being there.
    I hope this helps.
    Regards
    Andrew
    G4 17inch   Mac OS X (10.4.8)   2 Gigs RAM

  • UTF-8 Chacters Extracting from Java XMLDocument - Revised so example works

    I'm working on a string XML document that has utf-8 charcters within the
    text nodes, e.g. &;lsquo; &;rsquo; In the original string these are ok, and when represented through to a web page appear correctly as a &lsquo; &rsquo;
    quotes.
    <p>Example XML Document :- </p>
    <p><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?><br>
    <!DOCTYPE art [<br>
    <!ELEMENT art (#PCDATA | b)*><br>
    <!ELEMENT b (#PCDATA)><br>
    <!ENTITY lsquo &quot;&;#x2018;&quot;><br>
    <!ENTITY rsquo &quot;&;#x2019;&quot;><br>
    ]><br>
    <art><br>
    This ZZZ&;lsquo;La Sapienza&;rsquo; di Roma <b>some
    Text</b><br>
    ZZZZ&;lsquo;La Sapienza&;rsquo; 00185 ZZZZ<br>
    </art></p>
    <p>However if i use the oracle.xml.parser.v2.DOMParser to create a
    oracle.xml.parser.v2.XMLDocument from the String, I cannot get the text from the
    nodes correctly, using oracle.xml.parser.v2.XMLDocument.print(System.out) or
    through the org.w3c.dom.Node.getNodeValue().</p>
    <p>I need to Extract the <art> tags data,  the resulting text must be
    :-</p>
    <p>    <i>This ZZZ&;lsquo;La Sapienza&;rsquo; di Roma <b>some Text</b>ZZZZ&;lsquo;La Sapienza&;rsquo; 00185
    ZZZZ</i></p>
    <p>AND NOT :-</p>
    <p>      This ZZZbLa Sapienzab
    di Roma <b>some Text</b>ZZZZbLa
    Sapienzab 00185 ZZZZ</p>
    <p>AND NOT :-</p>
    <p>      <i>This ZZZ&lsquo;La Sapienza&rsquo; di Roma <b>some Text</b>ZZZZ&lsquo;La Sapienza&rsquo; 00185
    ZZZZ</i></p>
    <p>Example Program,  Just copy &; Paste into Jdeveloper</p>
    <p>Project Libraries Required  :- Oracle XML Parser 2.0 ( D:\jdev323\lib\xmlparserv2.jar
    )</p>
    <p>COPY FROM HERE >></p>
    <p> import java.io.IOException;<br>
    import org.w3c.dom.Node;<br>
    import org.xml.sax.SAXException;<br>
    import oracle.xml.parser.v2.XMLDocument;<br>
    import oracle.xml.parser.v2.DOMParser;<br>
    import oracle.xml.parser.v2.XSLException;<br>
    import org.xml.sax.InputSource;<br>
    import java.io.StringReader;<br>
    <br>
    public class Class3 extends Object {<br>
    <br>
    public Class3 () throws IOException , SAXException, XSLException{<br>
    String docText =<br>
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +"\n"+<br>
    "<!DOCTYPE art [" + "\n"+<br>
    "<!ELEMENT art (#PCDATA | b)*>" +"\n"+<br>
    "<!ELEMENT b (#PCDATA)>" +"\n"+<br>
    "<!ENTITY lsquo \"&;#x2018;\">" +"\n"+<br>
    "<!ENTITY rsquo \"&;#x2019;\">" +"\n"+<br>
    "]>" +"\n"+<br>
    "<art>" +"\n"+<br>
    " This ZZZ&;lsquo;La Sapienza&;rsquo; di Roma <b>some Text</b>"+"\n"+<br>
    " ZZZZ&;lsquo;La Sapienza&;rsquo; 00185 ZZZZ" +"\n"+<br>
    "</art>" + "\n";<br>
    System.out.println("----------------------------------------");<br>
    System.out.println("Original String Value ");<br>
    System.out.println("----------------------------------------");<br>
    System.out.println(docText);<br>
    System.out.println("----------------------------------------");<br>
    System.out.println("Value from XMLDocument.Print(Systen.out)");<br>
    System.out.println("----------------------------------------");<br>
    InputSource input = new InputSource(new StringReader(docText));<br>
    DOMParser xp = new DOMParser();<br>
    xp.setValidationMode(false);<br>
    xp.setPreserveWhitespace(false);<br>
    xp.parse (input);<br>
    XMLDocument xMLDocument = (XMLDocument)xp.getDocument();<br>
    xMLDocument.print(System.out );<br>
    <br>
    System.out.println("----------------------------------------");<br>
    System.out.println("Value from Node Walk");<br>
    System.out.println("----------------------------------------");<br>
    Node theNode = xMLDocument.getFirstChild();<br>
    this.walkNode(theNode);<br>
    }<br>
    <br>
    public void showNode (Node inNode) {<br>
    System.out.println(inNode.getNodeName() + " <--> "<br>
    + inNode.getNodeType() + " <--> "<br>
    + inNode.getNodeValue() + " <--> ");<br>
    <br>
    Node kid=inNode.getFirstChild();<br>
    if(kid==null) {<br>
    } else {<br>
    walkNode(kid);<br>
    }<br>
    }<br>
    <br>
    public void walkNode (Node theFirst) {<br>
    while(null!=theFirst){<br>
    showNode(theFirst);<br>
    theFirst=theFirst.getNextSibling();<br>
    }<br>
    }<br>
    <br>
    public static void main(String[] args) throws Exception {<br>
    Class3 class3 = new Class3();<br>
    <br>
    }<br>
    }<br>
    <<  END HERE</p>
    null

    import java.io.IOException;
    import org.w3c.dom.Node;
    import org.xml.sax.SAXException;
    import oracle.xml.parser.v2.XMLDocument;
    import oracle.xml.parser.v2.DOMParser;
    import oracle.xml.parser.v2.XSLException;
    import org.xml.sax.InputSource;
    import java.io.StringReader;
    public class Class3 extends Object {
    public Class3 () throws IOException , SAXException, XSLException{
    String docText =
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +"\n"+
    "<!DOCTYPE art [" + "\n"+
    "<!ELEMENT art (#PCDATA | b)*>" +"\n"+
    "<!ELEMENT b (#PCDATA)>" +"\n"+
    "<!ENTITY lsquo \"&#x2018;\">" +"\n"+
    "<!ENTITY rsquo \"&#x2019;\">" +"\n"+
    "]>" +"\n"+
    "<art>" +"\n"+
    " This ZZZ&lsquo;La Sapienza&rsquo; di Roma <b>some Text</b>"+"\n"+
    " ZZZZ&lsquo;La Sapienza&rsquo; 00185 ZZZZ" +"\n"+
    "</art>" + "\n";
    System.out.println("----------------------------------------");
    System.out.println("Original String Value ");
    System.out.println("----------------------------------------");
    System.out.println(docText);
    System.out.println("----------------------------------------");
    System.out.println("Value from XMLDocument.Print(Systen.out)");
    System.out.println("----------------------------------------");
    InputSource input = new InputSource(new StringReader(docText));
    DOMParser xp = new DOMParser();
    xp.setValidationMode(false);
    xp.setPreserveWhitespace(false);
    xp.parse (input);
    XMLDocument xMLDocument = (XMLDocument)xp.getDocument();
    xMLDocument.print(System.out);
    System.out.println("----------------------------------------");
    System.out.println("Value from Node Walk");
    System.out.println("----------------------------------------");
    Node theNode = xMLDocument.getFirstChild();
    this.walkNode(theNode);
    public void showNode (Node inNode) {
    System.out.println(inNode.getNodeName() + " <--> "
    + inNode.getNodeType() + " <--> "
    + inNode.getNodeValue() + " <--> ");
    Node kid=inNode.getFirstChild();
    if(kid==null) {
    } else {
    walkNode(kid);
    public void walkNode (Node theFirst) {
    while(null!=theFirst){
    showNode(theFirst);
    theFirst=theFirst.getNextSibling();
    public static void main(String[] args) throws Exception {
    Class3 class3 = new Class3();
    }

  • Simple Example, I Need Help!

    I'm working on a very simple application using Eclipse and MySQL here it is:
    http://img.photobucket.com/albums/v335/shlumph/table.jpg
    It's pretty self-explanitory. You enter a person's first and last name, press submit, and their name flops onto the table. I made this naively, and do not know how to make use of reflection and beans, if that's even what I need.
    I tried googling on how to make use of reflection and beans when dealing with database connectivity, but there's just so much different kinds of information, it's like trying to find a needle in a haystack.
    If someone could help point me in a direction to go, post some in depth tutorials, or even point out a good book that I can get on amazon, that would be excellent!
    Just incase if you care what I have done naively, here is the database structure and code:
    I have a database named addressbook with a table called names. Inside of names there are the following columns:
    first_name varchar(20)
    last_name varchar(20)
    public class example extends Composite {
         private Label firstNameLbl = null;
         private Text firstNameTxt = null;
         private Label lastNameLbl = null;
         private Text lastNameTxt = null;
         private Composite tableComposite = null;
         private Button submitButton = null;
         private Table nameTable = null;
         private Connection con = null;
         public example(Composite parent, int style) {
              super(parent, style);
              initialize();
         }//example()
         private void initialize() {
              GridData gridData1 = new GridData();
              gridData1.widthHint = 75;
              GridLayout gridLayout = new GridLayout();
              gridLayout.numColumns = 2;
              firstNameLbl = new Label(this, SWT.NONE);
              firstNameLbl.setText("First Name");
              firstNameTxt = new Text(this, SWT.BORDER);
              lastNameLbl = new Label(this, SWT.NONE);
              lastNameLbl.setText("Last Name");
              lastNameTxt = new Text(this, SWT.BORDER);
              this.setLayout(gridLayout);
              Label filler1 = new Label(this, SWT.NONE);
              submitButton = new Button(this, SWT.NONE);
              submitButton.setText("Submit");
              submitButton.setLayoutData(gridData1);
              submitButton
                        .addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
                             public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                                  getConnection();
                                  try {
                                       String firstName = firstNameTxt.getText();
                                       String lastName = lastNameTxt.getText();
                                       String sql = "INSERT names VALUES ('" + firstName + "', '" + lastName + "')";
                                       Statement stmt = con.createStatement();
                                       stmt.executeUpdate(sql);
                                       //Update the table
                                       nameTable.removeAll();
                                       addItems();
                                       //Close connections
                                       con.close();
                                       stmt.close();
                                  } catch (SQLException e2) {
                                       e2.printStackTrace();
                             }//widgetSelected()
              createTableComposite();
              this.setSize(new Point(241, 220));
         }//initialize()
          * This method initializes tableComposite     
         private void createTableComposite() {
              GridData gridData2 = new GridData();
              gridData2.widthHint = 200;
              gridData2.heightHint = 100;
              GridData gridData = new GridData();
              gridData.horizontalSpan = 2;
              tableComposite = new Composite(this, SWT.NONE);
              tableComposite.setLayout(new GridLayout());
              tableComposite.setLayoutData(gridData);
              nameTable = new Table(tableComposite, SWT.BORDER);
              nameTable.setHeaderVisible(true);
              nameTable.setLayoutData(gridData2);
              nameTable.setLinesVisible(true);
              TableColumn firstNameCol = new TableColumn(nameTable, SWT.LEFT);
              firstNameCol.setText("First Name");
              firstNameCol.setWidth(100);
              TableColumn lastNameCol = new TableColumn(nameTable, SWT.LEFT);
              lastNameCol.setText("Last Name");
              lastNameCol.setWidth(100);
              getConnection();
              addItems();
         }//createTableComposite()
          * This gets the MySQL Connection
         public void getConnection() {
              try {
               Class.forName("com.mysql.jdbc.Driver").newInstance();
               con = DriverManager.getConnection("jdbc:mysql:///addressbook", "root", "password");
             } catch(Exception e) {
               System.err.println("Exception: " + e.getMessage());
         }//getConnection()
          * This adds items to the address table
         private void addItems() {
              try {
                   String sql = "SELECT first_name, last_name FROM names";
                   Statement stmt = con.createStatement();
                   ResultSet rs = stmt.executeQuery(sql);
                   while(rs.next()) {
                        String first_name = rs.getString(1);
                        String last_name = rs.getString(2);
                        String[] row = new String[]{first_name, last_name};
                        TableItem item1 = new TableItem(nameTable, 0);
                        item1.setText(row);
              } catch (SQLException e) {
                   e.printStackTrace();
         }//addItems()
    } Message was edited by:
    shlumph

    Yes, the id column is auto-increment and not null. I
    kind of went on a rampage without reading your latter
    post and added some more stuff.So tell me why I bothered?
    I added in other columns: street, city, state, phone
    and email to my database. As well as
    fields/setters/getters to my Person class.What does adding more columns do when you can't even insert what you had? Seems foolish. Do the easy thing first, then expand.
    I think I went on a different, but similar route then
    what you mentioned with the database utility. Mine's the right way. 8)
    I
    tried making a MySQL generator
    interface/implementation along with a PersonDao
    interface/implementation, like you mentioned.
    Can you give me some more suggestions, I'm sure this
    is done noobly/poorly.I like that find idiom for method names. Why did you copy the interface I gave you and add "search"? The idea would be to add find methods that have different parameters. In your case, I'd have a find that takes two String arguments.
    It's not just being picky. Consistency matters. If you published this, a user would be likely to think "Why two find methods and a search? Did two people write this?" Pick one and stick to it.
    It's great, except for that search method. After all, it's what I gave you.
    >
    To give you an example, here is my implementation for
    methods delete, and find:
         public void delete(Person p) {
              mysql.delete("names", "id", p.getID().toString());
         public Person find(Long id) {
              Person p = new Person();
    ResultSet rs = mysql.find("names", "id",
    ", id.toString());
              try {
                   while (rs.next()) {
                        String firstName = rs.getString(1);
                        String lastName = rs.getString(2);
                        String street = rs.getString(4);
                        String city = rs.getString(5);
                        String state = rs.getString(6);
                        String zipCode = rs.getString(7);
                        String phone = rs.getString(8);
                        String email = rs.getString(9);
                        p.setID(id);
                        p.setFirstName(firstName);
                        p.setLastName(lastName);
                        p.setStreet(street);
                        p.setCity(city);
                        p.setState(state);
                        p.setZipCode(zipCode);
                        p.setPhone(phone);
                        p.setEmail(email);;
              } catch (SQLException e) {
                   e.printStackTrace();
              mysql.closeConnection();
              return p;
         }// find()Here is my MySqlGenerator interface:
    public interface MySqlGenerator {
         public ResultSet selectAll(String table);
    public ResultSet find(String table, String pkColumn,
    , String pkValue);
    public ResultSet search(String table, String column,
    , String search);
    public List<Object> select(String table, String
    g column);
    public void update(String table, String column,
    , String pkColumn, String pkValue, String newValue);
    public void save(String table, String column, String
    g values);
    public void delete(String table, String pkColumn,
    , String pkValue);
         public void closeConnection();
    }And to give you an example, here is the
    implementation for delete and find:
    public void delete(String table, String pkColumn,
    , String pkValue) {
              getConnection();
              try {
                   Statement stmt = con.createStatement();
    String sql = "DELETE FROM " +table+ " WHERE "
    E " +pkColumn+ "=" + pkValue;
                   stmt.executeUpdate(sql);
              } catch (SQLException e) {
                   e.printStackTrace();
              } finally {
                   closeConnection();
    public ResultSet find(String table, String pkColumn,
    , String pkValue) {
              getConnection();
              ResultSet rs = null;
              try {
                   Statement stmt = con.createStatement();
    String sql = "SELECT * FROM" +table+ " WHERE "
    E " +pkColumn+ "=" + pkValue;
                   rs = stmt.executeQuery(sql);
              } catch (SQLException e) {
                   e.printStackTrace();
              return rs;
         }So theoretically, if this was done well (which I'm
    sure it's not), I could put PersonDao, PersonDaoImpl,
    MySqlGenerator, MySqlGeneratorImpl, all into a
    package named persistence?I don't see what that MySqlGenerator is all about.
    No, I wouldn't recommend doing it this way. Put it all the in the PersonDaoImpl. Better yet, create a subpackage "jdbc" under persistence and put the PersonDaoImpl in there. JDBC is one way to implement this interface. There are lots of others. But this is what you should do to start.
    NEVER return a ResultSet from a method that way. Load the contents into an object or data structure and close it inside the method that created it. You're leaking a database cursor that way, AND you're exposing SQL stuff to clients. Keep all the persistence artifacts inside the persistence package. Don't let them leak out that way.
    Nope, sorry, I don't think this is it.
    %

  • Internationalised Example Help Needed

    My goal here is to put together an easily understandable example of an Internationalised stand-alone java application.
    To start, I would like to create a stand-alone java application that performs the following tasks:
    1. Has a pulldown that allows a user to select a language (English, Arabic, Korean, Greek, etc.) When the language is selected, I want to change the properties of a JTextFild so that when a user types in the JTextField, the characters that come out in the JTextField are in the language that was selected in the pulldown. I know how to create the pulldown, but how do I change the properties of the TextField dynamically?
    2. I have a JButton that, when pressed, stores the language selected AND the characters in the JTextField into a Sybase Database. It also adds the same info to a JList that displays a list of text strings (in the language that they were entered) with their selected language (in English). My questions here are:
    - How should I store the text in the database (Hex or Unicode?)
    - Is it possible to have a JList display different languages on different lines within the list?
    - Is there a generic font that can display ALL types of languages?
    Any help (especially code samples) would be greatly appreciated. I have read the tutorials on this site, but I didn't see anything that would help.

    What do you mean when you say "the characters that come out in the JTextField are in the language that was selected in the pulldown"? The characters that are displayed in the field depend on the characters that the user inputs. There are no properties to change.
    2. I have a JButton that, when pressed, stores the
    language selected AND the characters in the
    JTextField into a Sybase Database. It also adds the
    same info to a JList that displays a list of text
    strings (in the language that they were entered) with
    their selected language (in English). My questions
    here are:
    - How should I store the text in the database (Hex
    Hex or Unicode?)I don't know Sybase, so there may be implementation-specific issues, but for the DBs that I know, it would only make sense to configure the DB to store eveything in Unicode. If you store hex values, the DB will not be able to perform locale-dependent collation, etc.
    >
    - Is it possible to have a JList display different
    ent languages on different lines within the list?
    Yes, why not? As long as everything is in Unicode, you can display anything you want anywhere you want (single characters alternating, for that matter)
    - Is there a generic font that can display ALL
    ALL types of languages?Well, there are Unicode fonts that support MOST languages, but I think there will always be edge cases with new character sets that have only recently been added to the Unicode standard.
    Any help (especially code samples) would be greatly
    appreciated. I have read the tutorials on this site,
    but I didn't see anything that would help.In that case I recommend that you find some of the books on Java internationalization and study them. A simple Google search will also give you some helpful links.

  • PORT FORWARDING Step by step explanation needed

    I need a very easy to follow step-by-step explanation as I can't seem to work this out.
    I have broadband with a static IP address, it comes through my ethernet modem (D-Link ADSL Modem DSL-300T) this is connected to my Airport BaseStation (one with the modem port).
    I have three computers connected wirelessly, one desktop, and two laptops that are frequently out of the office.
    I want to set up my network so that I can use Apple Remote Desktop and FTP. I understand I need to open some ports on the basestation, but don't know exactly how or what ones. Also, do I need to set the macs up with DCHP with a manual address, or can I leave it at just DCHP?
    Any help would be greatly appreciated.

    Port Forwarding on an apple base station comes under the 'Port Mapping' section of the airport admin setup.
    I found a howto that could help you .
    http://www.roadstead.com/weblog/Tutorials/airport.html

Maybe you are looking for