Problem capturing "Enter Key" within 2 paragraph in JSP

I create a textarea for customer to enter their data. Something the data contain 2 paragraph with Enter Key involve. Then, i store the data into my database. Once i re-display the data back to customer, the data never show in 2 paragraph ?
who know.... pls pls help..... in JSP how am i going to do, so that the data disply in 2 paragraph.

Are you displaying the data again in TextArea? If not then you need to take care of '\r\n'. Split the data for '\r\n' and display the data in two paragraphs.
String wholeData="Your_Paragraph1\r\nYour_Paragraph2";
StringTokenizer st = new StringTokenizer(wholeData,"\r\n");
while(st.hasMoreTokens()) our.print(st.nextToken()+"<br>");Hope this helps.
Sudha

Similar Messages

  • Problem with Enter key and JOptionPane in 1.4

    Hi,
    I had a problem with an application I was working on.
    In this application, pressing [Enter] anywhere within the focused window would submit the information entered into the form that was contained within the frame.
    The application would then try to validate the data. If it was found to be invalid, it would pop up a JOptionPane informing the user of that fact.
    By default, pressing [Enter] when a JOptionPane is up will activate the focused button (in most cases, the [OK] button) thus dismissing the dialog.
    In JDK 1.3 this worked fine. But in JDK 1.4, this has the result of dismissing the dialog and opping it up again. This is because the [Enter] key still works on the frame behind the JOptionPane and thus tries to validate it again, which results in another invalid dialog msg popping up.
    The only way to get out is to use the mouse or the Esc key.
    Now, in the application I put in a workaround that I was not very happy with. So, to make sure it wasn't the application itself, I created a test which demonstrates that it still misbehaves.
    Here it is.
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.WindowConstants;
    * @author avromf
    public class FocusProblemTest extends AbstractAction
         private static JFrame frame;
         public FocusProblemTest()
              super();
              putValue(NAME, "Test");
         public void actionPerformed(ActionEvent e)
              JOptionPane.showMessageDialog(frame, "This is a test.");
         public static void main(String[] args)
              FocusProblemTest action= new FocusProblemTest();
              try
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch (Exception e)
                   e.printStackTrace();
              frame= new JFrame("Test");
              frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              Container contents= frame.getContentPane();
              contents.setLayout(new FlowLayout());
              JTextField field= new JTextField("Test");
              field.setColumns(30);
              JButton  button= new JButton(action);
              KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true);
              button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(enterKey, "test");
              button.getActionMap().put("test", action);
              contents.add(field);
              contents.add(button);
              frame.pack();
              frame.setVisible(true);
    }Does anyone have any solution to this problem?

    I know that focus management has changed alot.
    Based on my experimentation a while back, in 1.4 it still believes that the JFrame is the window in focus, even though a JOptionPane is currently in front of it (unless I misinterpreted what was going on). Thus, the frame seems to get the keyboard event and re-invoke the action.
    A.F.

  • Problem with enter key in the quiz templates

    hi,
    I need some i am using quiz templates and my problem is when
    i make the swf file and test the quiz it works good , but when i
    press the enter key , the quiz doesn't work and repeat and go to
    the first screen , i don't know if i have to block the enter key or
    how i can resolve this ?
    Thanks a lot

    I know that focus management has changed alot.
    Based on my experimentation a while back, in 1.4 it still believes that the JFrame is the window in focus, even though a JOptionPane is currently in front of it (unless I misinterpreted what was going on). Thus, the frame seems to get the keyboard event and re-invoke the action.
    A.F.

  • Capturing Enter Key Press

    Hi
      Is there a way where we can capture the Enter Key press of the Keyboard and call an event on the Enter Key Press??
    For fields such as input field there is onEnter field where an event can be called, but we have a requirement where in we need to call an event on click of enter key, irrespective of where the focus on the page is on.
    Any inpus on this will be helpful.
    Thanks & Regards,
    Gayathri Shanbhag

    Hi Gayathri,
    See if the following link helps:
    https://cw.sdn.sap.com/cw/docs/DOC-107045
    Regards,
    Himanshu

  • Capture ENTER key on numeric keypad

    I have several chemistry tutorials where users type something and then have it evaluated by pressing the ENTER key. This works fine for the ENTER key on the main part of the keyboard, but does not work for the ENTER key for the numeric keypad on keyboards with the two ENTER keys. How do I capture the ENTER key on the numeric keypad? In other words, how do I do the equivalent of the following for that key?  
    if the key = RETURN then
    Thanks

    Try checking:
    if _key.keyCode = 36 then ...

  • Capturing Enter key event from text box

    In my application, there are a number of text boxes. I want to create a feature where an enter key even is seen and specific function executed depending on which text box was in focus when the enter key was pressed. Currently I am able to capture an enter key event on the whole page. How do I do that specifically for a text box?
    This application is done in HTML, javascript and Adobe AIR.
    Thanks
    Binu
    www.verseview.info

    Hi
    That's true that Flex4.5 SDK under Flash builder Burito doesn't listen Enter key in Text Area for KeyUp or KeyDown event.
    Here I found a work around you can use.
    Add an eventlistener to the component in actionscript and set the useCapture=true next to eventlistener function. Now you can listen enter key for KeyUp or KeyDown Event
    Hope this helps
    Rush-me

  • Capture enter key press in h:inputtext

    hi,
    i have a h:inputText component in my jsf page. i need to capture the enter key pressed for this component. how can this be done.
    thanks in advance.

    You can use Javascript for this. In the onkeypress event, check if the keycode is 13 (the enter key) and handle accordingly.
    onkeypress="if (event.keyCode == 13) alert('Enter pressed!');"

  • Capture 'Enter' key event

    Hi,
    Is there any way we can capture the event when a user presses the enter key inside a text field?

    Hi andrewquay
    you can capture the enter key by adding the following code in the textfield's change event.
    if(xfa.event.change == "\u000a")
    xfa.host.messageBox("enter key is pressed");
    mail: [email protected]

  • Capturing ENTER key in WD4A

    Hi all,
    I m getting an input from the user in an Inputfield. I also have a table with two columns.
    The textfield is used to perform wildcard search (filter) for the table. That is, if i give a character like 'A', then the records which start with the character 'A' must be shown in the table when i press teh ENTER key..
    I have got this outptu when i click a button. But i want to get the same output, when i give 'A' and press ENTER key..
    How to acheive the same in WD4A?
    Regards,
    Shanthi

    hi Shanthi,
    for the corresponding Enter key , make a action say act in the EventPropery of the element.
    in the Onactionact,method in the Methods tab , write the same piece of code , which u r writting in the Button
    u wud be able to do it nw
    regards,
    amit

  • Multi line field Navigation problem with ENTER key

    No trigger on the field. Multi line Property is set to true.
    The probleb is, when the cursor reaches in the multi line field. the contents of the field are hilighted/selected. So as it happens in Notepad or Word, if you select some already written text and press ENTER key the selected text will be replaced by carriage return so the selected data will be lost. Same is the case with multi line field. When field gets focus it selects the contents of field and when ENTER is pressed all the contents are deleted and a carriage return is placed.
    any solution?
    null

    Hi Nadeem,
    One work around is that you have store content of that multi-line field in to some other variable thru PRE-TEXT-ITEM and once again assign (based on some conditon) in POST-TEXT-ITEM.
    null

  • Problem with Enter key on Aluminum Keyboard

    Just upgraded to an Aluminum iMac with the thin keyboard. We have a terminal application that communicates with our mainframe. The application looks for the 0x03 character, along with the NSNumericPadKeyMask flag, to determine that the Enter key was pressed, and then changes the character to a 0x0d (Return). This is because the 0x03 character is recognized as a Break key on the mainframe. However, when using the Aluminum Keyboard, the Enter key goes straight through as a 0x03, meaning the flag is not being set. To make things more interesting, if I use the Keyboard Viewer and click on the Enter key, the flag is set and the 0x0d is sent.
    Is there something else I should be looking for to recognize the Enter key? Perhaps something with the KeyCode? Is there some way to remap the Enter key to emulate the Return?

    I don't think you'll be able to control a Button symbol in the way you desire.  You probably need to create it as a MovieClip so that you can control what frame it is in.
    To utilize the ENTER key to take action, the following should work...
    var keyListener:Object = new Object();
    keyListener.onKeyDown = function() {
        if (Key.isDown(Key.ENTER)) {
             // do your button_mc control here
    Key.addListener(keyListener);

  • Capturing Enter key in ALV

    Hi Experts,
    Am using an editable alv. I want to perform some actions when Enter key is pressed.
    I did this in DOMODIFY. But this makes the scroll bar in initial position. Kindly help me on this.
    Regards,
    Vijayakumar.

    Hi vijayakumar,
    You can refer this link for info about ENTER key event trigger. Could you please post what you want to perform when Enter key is pressed.
    Link: [http://wiki.sdn.sap.com/wiki/display/ABAP/InteractiveEditableOOALVgridwithdynamicitab,FCATandENTERkeyeventtrigger]
    Regards,
    Anand G

  • Capturing TAB key within JTabbedPane

    I have a custom JComponent that is inside a JTabbedPane and the only way I can receive the keyPressed() event with you press TAB is if I override isManagingFocus() and return true. Otherwise the TAB key causes you to jump upto the tabs. But this is a deprecated API. How do objects like JTextArea capture TAB properly?
    Thanks.

    Ya, I see that. But I don't want to replace TAB with another key, I want to be able to process ALL keys on the keyboard and these new APIs don't accept null.
    Does anyone know how JTextArea does it?

  • Only when I'm in mozilla, the enter key becomes slow, very slow to change paragraph

    Only when I'm in mozilla firefox, the "enter" key becomes slow, very slow, to change paragraph. I do not this happens in "Word" and I do not this happens in other browsers. A
    nyone know what happens? (I have a good updated antivirus, there is not the problem). W
    hile waiting for an answer, thanks. M
    aurosti

    You could adjust the mailnews.tcptimeout preference, as explained in the 2nd point in [http://kb.mozillazine.org/Can_not_send_large_attachments this article]. Also, make sure there's no security program scanning outgoing mail attachments.

  • Firefox specific problems with slow reacting 'Enter' key

    I have recently experienced a slow reaction time from my 'Enter' key when typing paragraphs in Firefox - all other keys are fine but it can be really frustrating when pressing 'enter' to go to the next line and it takes about a second to react after being pressed - I have searched google and have found quite a few people have this same problem. It only ever happens when using firefox and is fine when using any other application. Any ideas?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

Maybe you are looking for

  • Problem Integrating APPS 11i with OAS discoverer 10.1.2

    Hi, I am trying to Integrate OAS 10.1.2.0.2 Discoverer with Oracle Applications 11.5.10.2, I am following Metalink Document Note:313418.1. one of the steps says 7. Import Discoverer Content for Release 11i using adupdeul.sh mode=complete so while run

  • Unable to connect to a proxy server, unable to connect to a proxy server

    i am unable to connect my iphone with my company's proxy server

  • Error 2356 While Installing iTunes 8.2

    Every time I try to install iTunes, it gets right past the Quick Time setup and says: "The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2356." I've redownloade

  • Regarding wieghted average

    Hi I have a requirement like this pasted below to calculcate the weighted average. A        B      C=B*A   Wtd avg 2     300$     600$     1.92 1     200$     200$     (1250$/650$)=1.92 3     150$     450$     1.92 Overall Result: 6     650$     1250

  • ICP Calculation from ICP NONE

    Hello All, i am loading TB data where TB contain ICP Value aswell where [ICP NONE] includes ICP data value. "Data Load = A#Account.I#[ICP None].C1#Member.C2#Member#C3#Member.C4#TB_Load" Now, user is inputing ICP data through forms by selecting ICP En