How can i getParameter then put inti DOM...

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="javax.xml.parsers.*" %>
<%@ page import="org.w3c.dom.*" %>
<% String getCate = request.getParameter("category"); %>
<html><head>
<title>DOM Parser</title>
</head>
<body>
<%  // Create the file object we will read from
  File f = new File("C:/Program Files/Tomcat 6.0/webapps/wsd/recipes/index.xml");
  // Create an instance of the DOM parser and parse the document
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  Document doc = db.parse(f);
  // Begin traversing the document
  traverseTree(doc, out);
%>
<%!
  //Get parameter from index to look up recipes follow category
  private void traverseTree(Node currnode, JspWriter out) throws Exception {
    // If the current node is null, do nothing
    if(currnode == null) {
      return;
     //out.println("<blockquote>");
    // Find the type of the current node
    int type = currnode.getNodeType();
    // Check the node type, and process it accordingly
    switch (type) {
    case Node.DOCUMENT_NODE:
      //out.println("<p>DOCUMENT</p>");
      traverseTree (((Document)currnode).getDocumentElement(), out);
      break;
    case Node.ELEMENT_NODE:
      //String elementName = currnode.getNodeName();
          //if (elementName.compareTo("title") == 0) {
      //     out.println("<p>ELEMENT: [" + elementName + "]</p>");
      //if (currnode.hasAttributes()) {
      //  NamedNodeMap attributes = currnode.getAttributes();
      //  for (int i=0; i < attributes.getLength(); i++) {
      //    Node currattr = attributes.item(i);
      //    traverseTree(currattr, out);
      NodeList childNodes = currnode.getChildNodes();     
      if(childNodes != null) {
        for (int i=0; i < childNodes.getLength() ; i++) {
          traverseTree (childNodes.item(i), out);
      break;
    case Node.ATTRIBUTE_NODE:
    //  String attributeName = currnode.getNodeName();
    //  String attributeValue = currnode.getNodeValue();
    // out.println("<p>ATTRIBUTE: name=[" + attributeName +
    //  "], value=[" + attributeValue + "]</p>");
      break;
/*    case Node.TEXT_NODE: {
*          Node parent = currnode.getParentNode();
*          if (parent != null) {
*               Node grandParent = parent.getParentNode();
*               if (grandParent != null) {
*                    if ((grandParent.getNodeName().equals("track")) && (parent.getNodeName().equals("title"))) {
*                     String text = currnode.getNodeValue().trim();
*                     if (text.length() > 0) {
*                            out.println("<p>" + text + "</p>");
*      break;
     case Node.TEXT_NODE: {
       Node parent = currnode.getParentNode();
       if (parent != null) {
            Node grandParent = parent.getParentNode();
          if ((grandParent.getNodeName().equals("recipe")) && (parent.getNodeName().equals("category"))) {
            String compare = currnode.getNodeValue();
            if (compare.equals(getCate)) {
                 String text = currnode.getNodeValue().trim();
               if (text.length() > 0) {
                    out.println("<p>"+currnode.getPreviousSibling()+"<br />");
                    out.println(text+"<br />");
                    out.print(currnode.getNextSibling()+"</p>");
       break;
  //out.println("</blockquote>");
%>
<hr />
</body></html>
<%@page import="java.io.*, java.lang.*, java.net.*"%>I get a parameter from an html file (on line 4)
<% String getCate = request.getParameter("category"); %>then use getCate as a String to compare with get current Node in DOM to print out
String compare = currnode.getNodeValue();
            if (compare.equals(getCate))like this. But there is a problem...
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 110 in the jsp file: /process.jsp
getCate cannot be resolved
107:           if ((grandParent.getNodeName().equals("recipe")) && (parent.getNodeName().equals("category"))) {
108:           
109:           String compare = currnode.getNodeValue();
110:           if (compare.equals(getCate)) {
111:                String text = currnode.getNodeValue().trim();
112:                if (text.length() > 0) {
113:                     out.println("<p>"+currnode.getPreviousSibling()+"<br />");
Stacktrace:
     org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
     org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
     org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
     org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
I tried to to get it above the traverse tree but it didn't help either...
What should i do.
Thx

1 more. when i put it above traverse tree, it appear is cannot resolve
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 24 in the jsp file: /process.jsp
request cannot be resolved
21:
22: <%!
23: //Get parameter from index to look up recipes follow category
24: String getCate = request.getParameter("category");
25:      
26:      
27: private void traverseTree(Node currnode, JspWriter out) throws Exception {
Stacktrace:
     org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
     org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
     org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
     org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
<%!
  //Get parameter from index to look up recipes follow category
  String getCate = request.getParameter("category");
  private void traverseTree(Node currnode, JspWriter out) throws Exception {
    // If the current node is null, do nothing
    if(currnode == null) {
      return;
...

Similar Messages

  • My company runs Adobe Acrobat XI on a PC.  Our PC went down and we replaced it with a new one.  We need Acrobat XI on it and have bought it already.  How can I get it put onto our new computer?

    My company runs Adobe Acrobat XI on a PC.  Our PC went down and we replaced it with a new one.  We need Acrobat XI on it and have bought it already.  How can I get it put onto our new computer without having to buy it again?

    Hi chrisb75729216,
    I checked with your account but could not find any order history so you might be using another email address on forums.
    You will first need to deactivate Acrobat from old machine and then install Acrobat on the new machine by activating with the same serial number.
    Please download Acrobat XI pro from here: Other downloads
    If you have single user license, then remember that the software can be activated on maximum two computers, say your desktop at work and laptop at home.
    Regards,
    Anubha

  • I update my iPad with the new version 7.0.3 and my game Hay Day also was updated, but with another Apple ID that is not mine, how can i change and put my Appel Id ??

    I update my iPad with the new version 7.0.3 and my game Hay Day also was updated, but with another Apple ID that is not mine, how can i change and put my Appel Id ??

    Anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID
    Apple ID FAQs  >  http://support.apple.com/kb/HT5622

  • When i try to update my iPhone 3G software, the message alert showing (The iPhone ''iPhone'' could not be restored. An unknown error occurred). now my iPhone 3G blank display. how can i do then please?

    when i try to update my iPhone 3G software, the message alert showing (The iPhone ''iPhone'' could not be restored. An unknown error occurred). now my iPhone 3G blank display. how can i do then please?

    I was not sure about the ''jailbroken''. now my iPhone cannot use, on the showing (connect to iTunes logo). so if i just want my iPhone process in normal, what can i do? i mean i want it back to the previous software version?

  • How can I make it put the folder in the current highlighted folder?

    When I am in a sub folder and want to create a new folder I got to File > New Folder and it always create the folder at the route in list view.
    How can I make it put the folder in the current highlighted folder?
    Kevin

    Open the subfolder in it's own window. The window has focus, that's why the new folder is created at its root level.

  • How can send servlet out put to jsp

    Hi friends,
    my problem is ..
    1.In my jsp (let us assume that Test.jsp ) emded tag which emding out put from Servlet.. like
    <embed name="svg" border="1" type="image/svg+xml" width="100%" height="100%" src="http://localhost:8080/demo/Test?"/>
    here the jsp is calling Servlets but at the time display the jsp cannot understand the out put comming from servlets ..
    plz help how can read a Servlet data from JSP
    thanks

    Use <jsp:include page="relative_url_to_servlet"/>. Then have your servlet get the PrintWriter for output from response.getWriter() and you should have it.
    I do this every once in awhile.

  • I update my iCloud storage today but I paid with my wife's credit card and now anytime that I sended an email appears the name of her instead of mine to all my contacts ??? how can I change and put my name in my emails ??

    hi please I need help , I paid with my wifes credit card the upgrade in my icloud storage today but now any time I send an email appears ....from: my wifes name instead of my name ....how can I change this ,thank you

    You might want to make sure your credit card is listed in the billing information associated with your Apple ID (see http://support.apple.com/kb/ht1918).
    Also, to change the From name that appears when you address emails on and iOS device, go to Settings>Mail,Contacts,Calendars...tap your iCloud email account, tap you iCloud account at the top, tap Mail at the bottom, then enter the name you want to use in the Name field at the top.
    To change the From name on your Mac Mail, go to icloud.com, sign into your account, open Mail, click the gear shaped icon on the bottom left and choose Preferences, go to the Accounts tab and enter the name you want to use in the Full Name field and click Done.  Then quit Mail on your Mac and re-open it.  Your new From name should now appear in the drop-down list when you compose a new email.

  • Ask your question.I installed the app" Find my phone for my Ipad. But I also installed that app on my Iphone. but the Iphone app still just shows where my Ipad is located and not the phone, how can I get then both to show location?

    I installed the App" find my Iphone on my Ipad.. its working well.
    But I also need to be able to track my Iphone if lost... I also have the app on my Iphone but when I click on it to find my phone it is showing me where my Ipad is... how can I get it to show my Iphone also? the chances of me losing my Ipad are less then my Iphone.But I need to be able to trac both.

    How was your wife using the Find My iPhone app from a Samsung phone? But, that question aside, your wife should educate herself on how GPS works, especially on a cell phone. GPS signals can be interfered with by trees, buildings, clouds. Off by several miles would be unusual, though.
    If your wife is tracking your cell phone and not believing what you tell her, you may want to consider counseling as there are some very serious issues that go way beyond the technology.
    Best of luck.

  • How can I do to put informations (integers booleans or doubles) in an array or a table ?

    I have some number vectors and I want to concatenate them (in fact I want to put them in the same line) in the line of a table (or an array). Each time I pushed a button, I add a new line of informations to my table.
    How can I do ?
    Regards.
    Cyril.

    something like this?
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    Table_2003.vi ‏38 KB

  • After transferring clips to Final Cut, they do not show up in the events library. They show up in the timeline of my project, though. how can I see then in the events browser?

    After importing clips to Final Cut, they do not show up in the events library. Events from 2014 show up, but not 2015.They show up in the timeline of my project, though. How can I see them in the events browser?

    TThose aren't bins. Those are just groupings based on when the content was created or any other selected parameter. Use the action popup in the toolbar tho change the setting.

  • HT204266 I used an iTunes gift card on my iPad but although it said I have positive balance, also said that I can't update or buy anything because I have not provide a credit card, how can I avoid to put my credit card in the iPad?

    I bought a iTunes card and I summited in my iPad, now that I want to used it to pay for Apps, it seems that it doesn't want to used the balance available from the iTunes card,
    I disconect and connect back so, it can see the iTunes balance, but when is looking to connect it said that the connection with iTunes Store is impossible. Now I have apss that need updates and I can do it because I have a negative balance and a credit available in the iTunes card.
    How can I make it switch to used the balance available.
    Thank you for your kind response.

    Not clear what you mean by iTunes help. You can contact iTunes support by:
    Apple - Support - iTunes - Contact Us

  • How can I move then main text in the San Francisco - CV? I moved my name (the box) and adress by just moving them up. But cant move the text!?

    Hi how can I move the main text in the "San Fransisco CV" up.
    The name thats in the "box" as the "adress" ect, is easy to move up...
    But the main text please...
    BR,
    D

    David,
    The various templates in Pages seem to have been designed by individuals without much guidance or mandate for standard approaches to layout. In a way, tha's good because you have a variety of philosophies to choose from.
    The message is that you can't take what you learned here and assume that all the templates work this way. I answered your question by turning on the Layout View and looking at the Inspectors to see what controls had been used.
    Jerry

  • In finder places is missing how can i get to put it on the side bar

    in finder places is not there how can i get it to be there

    If you are using Lion, places no longer exists.  It is now favourites, I understand.
    Oh, BTW, it would help if you would fill out your profile ... otherwise we have to answer with guesses. 

  • My MacBook Pro crashed and  need the files on my hard drive, but I only have a Windows PC. How can I get then out?

    I got my MacBook Pro in 2004.
    Over the years, I have put many files in it.
    And now that it crashed, I need help to get then back.
    The only problem is that I don't have another Mac, only a pc..
    Please help...

    Hi H,
    The first MBP was produced in 2006, so you either don't have a MBP or it's from 2006 or later.
    You have no backup?
    What "crashed?"
    If the HD is good, you can put it in an external enclosure and access it with a Mac from there.

  • How can i delete then re set up my emails?

    Please help, just got a new giffgaff sim and got all services but not email, got the add on i need but cant seem to get them, thinking if i delete the accounts on my handset then re add them it might work?
    any suggestions welcome,
    thanks! x

    Please try this FIRST, using your BlackBerry browser...
    1)
    • Go to mobile.blackberry.com OR to www.blackberry.com/integrate
    • Scroll down to Communication and then to Email.
    • Choose the appropriate email set up options.
    If that works and completes your email setup/editing, good.
    If not, follow these additional instructions:
    2) Register HRT: (OS5) Home Screen > Options > Advanced Options > Host Routing Table > Scroll to any line entry and > press the Menu key > and then click Register Now. If you have an OS 6 or OS 7 device, Look at Options > Device > Advanced > Host Routing Table, etc.
    3) Resend Service Books: Article ID: KB02830 How to send the service books for a BlackBerry Internet Service account. http://www.blackberry.com/btsc/KB02830
    4) Then, with the BlackBerry device POWERED ON, remove the battery for a minute, and then reinsert the battery to reboot. A reboot in this manner is prescribed for most glitches and operating system errors, and you will lose no data on the device doing this.
    5) Now, return to the 1) mobile.blackberry.com email setup as mentioned above and follow that.
    Hopefully that will get things going again for you!
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for

  • Move a file from one lacation to another in FTP

    Hi Experts, i have scenario were i have to move a file from one location to another in a FTP the source and the Target  structure are same can we go  with only configuration(ID) why because there is no mapping done but i have dbout when we create a s

  • Two video cards?

    The info on the Macbook Pro says: "... NVIDIA GeForce 9400M + 9600M GT 512M..." Do the Macbook Pros actually come with two video cards or are we to choose between the two when ordering. If they come with both, are we forced to allow the OS to choose

  • No pattern in my inability to not chat with certain users

    I have 4 buddy's that I am trying to Video with. 2 work great. They both own new iMacs. I have a third buddy that bought a new iMac and I get the communication error message. IM does work with these users. My most recent friend has a PC with AIM. The

  • ICal, 10.5.6, MobileMe & the new Automatic Sync Features

    when I read the release notes for 10.5.6 and saw that they had finally (/___sbsstatic___/migration-images/migration-img-not-avail.png) got ical to sync "instantly" from computer to computer in any direction, I knew it was time to download. Did the in

  • Java webstart on Mac OS9.2

    Hi I have a java webstart application that uploads files to my website, I now have 2 people that want to upload to my site that are running mac OS9.2. They both seem to be having the same problem as that the java application just does not start. They