I'm trying to create a servlet that add something to the same html page.

Hello, below is my code: I'm trying to type a string in a field (html) and have it add to my vecctor, which is what I'm not sure how to create.
Basically everytime I type something on this field I want it to refresh itself but kind of add the new text in some sort of tables....but I can;t get the vector to work..and not sure how to create it.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Guestbook extends HttpServlet
     public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
          response.setContentType("text/html");
          PrintWriter out = response.getWriter();
          String add = request.getParameter("add");
          out.println("<html>");
          out.println("<head>");
          out.println("<title>Add</title>");
          out.println("<LINK rel='stylesheet' type='text/css' href='http://localhost:8080/BookNook/kool_style.css' />");
          out.println("</head>");
          out.println("<body>");
          out.println("<form name='form1' method='get' action='http://localhost:8080/BookNook/servlet/Guestbook'>");
          out.println("Name :");
          out.println("<input type='text' name='add'>");
          out.println("<input type='submit' name='Submit' value='Add'>");
          out.println("</form>");
          vector names = new vector();
          out.println("<br>");
          out.println("<hr width='500' size='3'>");
          out.println("hello " + add);
          out.println("</body>");
          out.println("</html>");
}

Hello
I don't qualify for a java guru, butI can offer some advice.
I don't know of any reason that a vector couldn't apply in this situation. The only issue with the code you posted is that vector is lowercase. Vector names = new Vector(); and names.add(add); should work in theory.

Similar Messages

  • Trying to create multiple lines of radio buttons on the same page. how do i do that??

    Greetings. I'm brand new to this, and am trying to create a form with multiple lines of radio buttons on a single page to send to my students.  How can I do this??  I currently have a table that I want the students to fill out and return, but every time I put radio buttons in, the form only allows selection of one of the 12 - I want students to be able to select one on each row.........

    Each group of three radio buttons for a row should have the same field name and different "Radio Button Choice" (see Options tab). So if you copy & paste the first row, be sure to rename the new ly added radio buttons.

  • Hello! Is there a way to create a shortcut that toggles on/off the checkbox "Allow pages to choose their own colors, instead of my selections above" located in Tools/Options/Content/Colors? I have to change this setting many times and need to speed it up.

    I have looked for add-ons that could automate this configuration change, but to no avail. Only web page actions can be recorded in a macro, but no configuration changes.
    A shortcut to get to the appropriate dialog box would help as well. I could manually tick/untick the box while saving all the several steps needed to get there. But I have not found it anywhere.
    Thank you very much for any help you can provide me.
    Best regards,
    Alex

    Hi, I want to drop a note to say thank you, cor-el. Your answer was better and faster than I could have expected. It not only solved my problem, but also opened new possibilities for more quick configurations.
    I am now obliged to follow your example and join this wonderful community of volunteers that help others to enjoy this fantastic browser.
    Best Regards!
    Alex

  • Create a playlist of all artists singing the same song (covers)

    I'd like to create a playlist that has all of the same songs in my iTunes library that are sung by different artists. I can sort my music, of course, by title but then I have to manually move songs to a playlist. I'm looking for some kind of automated way to do this.

    You can create a Smart Playlist that will help. Go to the File menu and choose New Smart Playlist.
    In the first menu, choose Name. Then type in the song title in the third field so that it reads "Name contains _______"
    This will put all versions of the song into a single playlist.
    You can click on the plus sign on the right to add another rule, which you set the same as the first, but with a different song title. That will have all versions of the two songs in one playlist. Etc.
    If you check Live Updating at the bottom of the window, then any new songs you add that fit the bill will automatically be added.

  • Trying to create a text that is on fire or more like a hot branding iron

    Trying to create a text that is on fire or more like a hot branding iron

    Something like this?
    That was from a project I did a few months ago.  Sounds similar to what you want.  I did that in After Effects.
    Basically all I did was add a glow effect to the text and messed around with the glow parameters.  The black smoke is animated and moves on the actual video and is basically some pre keyed smoke footage that I had.  The smoke was originally gray but black looked cooler.
    I'd say it's pretty close to your hot branding iron thing.

  • I am creating a form on LiveCycle Designer and I am trying to create a form that has a e-mail submit button.  When the butten is utilized it attaches the form to the e-mail in an plain text .xml format rather than the pdf format.  Is there a quick fix?

    I am creating a form on LiveCycle Designer and I am trying to create a form that has a e-mail submit button.  When the button is utilized it attaches the form to the e-mail in an plain text .xml format rather than the pdf format.  Is there a quick fix?

    Hi,
    You have the choice between xml or pdf, in later versions of designer you can choose with a dropdown on the email button Object palette, the "Submit As";
    In earlier version you had to edit the XML Source and change the format from xml to pdf (or vice-versa);
    Regards
    Bruce

  • Trying to create a service that starts at boot

    People,
    I'm trying to create a service that will start at boot (in single-user mode, actually). I am up and running but I do NOT want to run the service now. I only want to run the service when the machine reboots.
    I've been rummaging around all day trying to figure this out but I'm stuck. I can create a service that runs. I can create an XML file in /var/svc/manifest/site/patch-install.xml that will be read when I boot- because after I boot, I can list the service:
    svcs -a | grep patch
    disabled       18:23:23 svc:/site/patch-install:defaultI have inserted the following in my xml:
    <create_default_instance enabled='true' />and also
    <create_default_instance enabled='false' />but it makes no difference. Anyone have any idea? What is the purpose of create_default_instance? I don't understand; item 9 on http://www.sun.com/bigadmin/content/selfheal/sdev_intro.html seems rather opaque to me.
    Also, what exactly is the purpose of /var/svc/profile/ ? I tried putting some code to enable my xml but it didn't do anything. Just wondering if this might fit into the picture.
    BTW, I do not want the login prompt to appear until my method is complete.
    Thanks.
    -mschwage
    Here fyi is my /var/svc/manifest/site/patch-install.xml file:
    <?xml version="1.0"?>
    <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
    <service_bundle type='manifest' name='Patches:patch-install'>
    <service
            name='site/patch-install'
            type='service'
            version='1'>
            <create_default_instance enabled='false' />
            <single_instance />
            <dependent
                    name='patch-install_single-user'
                    grouping='require_all'
                    restart_on='none'>
                    <service_fmri value='svc:/milestone/single-user' />
            </dependent>
            <exec_method
                    type='method'
                    name='start'
                    exec='/var/tmp/S92delay'
                    timeout_seconds='86400' />
            <exec_method
                    type='method'
                    name='stop'
                    exec=':true'
                    timeout_seconds='0' />
            <property_group name='startd' type='framework'>
                    <propval name='duration' type='astring' value='transient' />
            </property_group>
            <stability value='External' />
            <template>
                    <common_name>
                            <loctext xml:lang='C'>
                            Install patchset upon boot.
                            </loctext>
                    </common_name>
            </template>
    </service>
    </service_bundle>

    Hushpuppy wrote:
    People,
    I'm trying to create a service that will start at boot (in single-user mode, actually). I am up and running but I do NOT want to run the service now. I only want to run the service when the machine reboots.I'd probably create the service now (by importing the manifest manually rather than waiting for the reboot), then set general/enabled in the default instance to be be true with svcprop. That should tell it to start at boot, but not enable it immediately.
    I've been rummaging around all day trying to figure this out but I'm stuck. I can create a service that runs. I can create an XML file in /var/svc/manifest/site/patch-install.xml that will be read when I boot- because after I boot, I can list the service:Yes, that's the default. Or you can load it immediately to create the service now.
    # svccfg import patch-install.xml
    I have inserted the following in my xml:
    <create_default_instance enabled='true' />and also
    <create_default_instance enabled='false' />but it makes no difference. Anyone have any idea? What is the purpose of create_default_instance? I don't understand; item 9 on http://www.sun.com/bigadmin/content/selfheal/sdev_intro.html seems rather opaque to me.There's a difference between a "service" like network/smtp or console-login and an "instance" like network/smtp:sendmail or console-login:default. In most cases, you just want a single "default" instance of your service. The above line sets the default instance 'enabled' property to true or false. When I import your manifest as is, the service comes in as 'disabled'. If I set it to true, it comes in as 'maintenance' (almost certainly because it was enabled, tried to start, and couldn't find the start method on my machine).
    Also, what exactly is the purpose of /var/svc/profile/ ? I tried putting some code to enable my xml but it didn't do anything. Just wondering if this might fit into the picture.'profiles' are loaded exactly once, and they are mainly used to set certain services to enabled or disabled.
    3 of them are loaded if present, platform.xml, generic.xml, and site.xml. The last is not generated by the OS, but left for you to use. But it's usually only useful as a "first boot" type thing. Because if you make changes to it, it will not be reread. This isn't usually a problem because after first boot you're in control of the services. The usual thing is that at first boot the manifests load to create services, then the profiles are loaded to set then enabled or disabled. This isn't possible before that point because there's no service to modify yet.
    BTW, I do not want the login prompt to appear until my method is complete.Any login prompt like a network login, or only the console login prompt? If the latter, then you'll want a dependency so that system-console-login depends on your service. But if your service has a problem at boot time, you'd make it difficult to log in.
    Darren

  • Trying to create a property that has a structure to it

    Hello:
    I am trying to create a property that has a structure to it.  Specifically, I am trying to create a multi-valued property called checks.  This property is composed of check number, check date and check amount.
    The data for this should display like the rows in a table, like an Excel spreadsheet.
    I realize this is a tall order.  However, is this possible?  I have tried the composed of feature, but did not find this to work.
    The best I could come up with so far is to have three multi-valued properties each for check number, check date and check amount.  The user would then need to ensure that the first entry for check number applies to the first entry for check date, and then the second entry for check number applies to the second entry for check date, and so on, and so on...
    Any ideas?
    Thanks.
    Bill
    (508) 259-6605

    Hi,
    You have the choice between xml or pdf, in later versions of designer you can choose with a dropdown on the email button Object palette, the "Submit As";
    In earlier version you had to edit the XML Source and change the format from xml to pdf (or vice-versa);
    Regards
    Bruce

  • Hello, I trying to create a program that would run a household furnace. I can't find a way to set timers for the ignitor,flame sensor and blowers. Any thoughts.

    Hello, I'm trying to create a program that would run a household furnace. I can't find a way to set timers foe the ignitor,flame sensor and blowers. Any thoughts would be greatly appreciated. Thanks, primetime

    In the detailed help for the event structure there is a link to caveats and recommendations for using event structures.  It is a good starting point.
    It is courteous to let the Forum know when your questions are related to a school assignment or homework.  We are glad to help you learn LabVIEW, but do not do your homework for you.
    You have learned the major disadvantage of the sequence structure: It must run to completion before anything else can happen.
    If you are building a state machine (typically a while loop with shift registers enclosing a case structure with one case per state) and having trouble with timing, then think about your requirements. Apparently you have some time delays, but under certain conditions you must terminate a delay/wait and do something else.  One way of doing this is to have a Wait state.  The wait state has a short delay, determined by the minimum time you can delay responding to a changed condition, and a check to see if the required elapsed time has occurred.  If the time has not elapsed, the next state is the Wait state again.  The state machine can repeat any state as often as necessary.  So a 15 second delay could be implemented by going to a Wait state with a one second wait 15 times. Any error or new command will see a response in no more than one second.
    Lynn

  • I am trying to create a signature for my emails. The box that asksto 'choose a signature' won't allow me to. Any suggestions?

    I am trying to create a signature for my emails. The box that asks to 'choose a signature' won't allow me to. Any suggestions?

    It's ok, I got it sorted :-)

  • Hi, I tried to create a slideshow that contain more than 500 photos. Now, trying to open / execute / select the slideshow, iPhoto hangs with the spinning coloured wheel and I have only to force the deletion from System Preference. Any suggestion?

    Hi, I tried to create a slideshow that contain more than 500 photos. Now, trying to open / execute / select the slideshow, iPhoto hangs with the spinning coloured wheel and I have only to force the deletion from System Preference. I already tried to rebuild the iPhoto Library (all the possible options) and tried to update teh version from 9.4.3 to 9.5 but the problem still persists: is there a way to delete this slideshow without selecting it ? How can I solve the problem, please?
    Kind Regards

    Can you restore your iPhoto Library from a backup version, that was created before you added the slideshow?
    If not, have you tried to rebuild the slideshow with iPhoto Library Manager?
    As described by Terence Devlin here:  Re: iphoto library was created with an unrelased version of iphoto please quit and ugrade library by opening it in iphoto 2 or iphoto 4

  • I am trying to create a slideshow that switches pictures every 0.3 seconds, however it keeps taking me back to 1.0 second?

    I am trying to create a slideshow that switches pictures every 0.3 seconds, however it keeps taking me back to 1.0 second?

    What application might you be using to show the slideshow?

  • Is there a way to link or create a widget that links back to the iTunes U app on your iPad from your iBook?

    Is there a way to link or create a widget that links back to the iTunes U app on your iPad from your iBook?
    I have already found the Apple Widget Builder (http://widgets.itunes.apple.com/builder/) and that works fine if you want to link to the "App Store", but I want to know if there is a way to "open an app" that is already installed on the iPad instead of double tapping the home button to switch between apps. (I know using the home button is very simple, but I am trying to find an even easier way to just "tap a widget" or "link" that will open iTunes U right up) I am only asking if this is possible for people who may have a hard time running an iPad at the beginning.
    I appreciate any help, thanks!

    I appreciate your help, but I had already looked at LinkMaker and I thought that was my answer, but as far as I could tell that still only links to an app in the app store. Yes it will link to iTunes U in the app store and you can then hit Open, but that is too drawn out of a process. We would like to know a way to just open the app directly.
    Thank you!

  • Itunes will not launch, it shows  message of "itunes library .itl" can not be read because it was created by a newer version of itunes. I tried opene it in save mode but I had the same problem.

    Itunes will not launch, it shows  message of "itunes library .itl" can not be read because it was created by a newer version of itunes. I tried opene it in save mode but I had the same problem.

    If you still have an issue you may have to see about using the iTunes version (application) included with Snow Leopard 10.6 from the installer or an another one if available online, and see if that will install.
    Sometimes you may have uninstall the bits left in your system by the earlier (or later) iTunes installers; as they all leave a trace and these can stop a different version of iTunes from being installed.
    Not sure if the following site/link will tell the method...
    •Apple - Support - iTunes - install & update:
    http://www.apple.com/support/itunes/install/
    •Troubleshooting iTunes installation on Mac OS X:
    http://support.apple.com/kb/HT2311
    Good luck & happy computing!
    ps: i see you resolved this issue. it's magic!

  • I am trying to create my own apple id, but when i try to click creat my id, i am redirected to the same page, there are no errors saying anything is wrong

    i am trying to create my own apple id, but when i try to click creat my id, i am redirected to the same page, there are no errors saying anything is wrong

    Here is a link that should meet your needs.
    Rescue email address and how to reset Apple ID security questions
    Let us know how you got on.

Maybe you are looking for

  • Is it possible to use  one imac to control the screen of another?

    Hi, I'm thinking of buying a new iMac. At present I have an older intel iMac (1.83, 17 inch, 2 Gigs ram, 250 hd) and I work mainly with Logic Pro 8. Logic Pro 8 has a node function which allows you to use the processing power of a second computer to

  • Torch 9860 wont turn off completely

    I bought a new Bb torch 9860 the day before. It was working perfectly fine untill this evening. It has now stopped turning off completely which it was doing very well before. Now it goes into a standby - like mode and quickly turns on when the red bu

  • SAP AFS Upgrade from version 5.0 to 6.4

    Hi Experts, I wanted to know if someone here was familiar with the SAP AFS upgrade from 5.0 to 6.4. I wanted to know how exactly they improved the  areas listed below. (obtained from SAP Course). Your help would be greatly appreciated http://www.sap.

  • Final Cut Pro Studio installation error

    Hey... I was installing the software. About half way through installing it said error and stopped; so I'm confused... should I trash everything installed and start all over?

  • Cotnainer element in Workflow

    HI all, I have created a container element in work flow. When i am trying to execute the work flow am nto abel to see that container element in the input screen. Can any one let me know what can be the reason behind the same.