Dynamically scrollable html:textarea

Hi,
Can someone please tell me how to make a html:text area scrollable and dynamic(rows are populated from DB). I am using struts and am populating in the jsp page using logic:iterate tags.

An HTML textarea becomes scrollable as soon as it's content spans rows greater than the display. This is automatically done by the browser. You need to specify how may rows the textarea should display ( this decides how large it will be, vertically ) and that's it.

Similar Messages

  • To display value in html: textarea in struts

    Hello,
    I want to display value in <html:textarea> in struts application from my userdefine FormBean.
    i tried like this
    <html:textarea property="documentNumberList" value='"<bean:write name="QualityForm" property="displayDocumentNumber">" ></html:textarea>
    I am not getting success.
    I would be appriciate to you if anyone could let me know what is the solution of this problem ? or send me one example.
    Thanks
    Rajnish
    [email protected]

    Hi,
    That did'nt solve my problem. Actually i am trying to get the arraylist data one by one into different textareas. There are two arrays one is quesArray and the other quesIdArray. I need the quesIdArray in the individual text areas.How can i achieve this?
    I am using the following code to do that.
    <logic:iterate id="item" name="selectionCriteriaForm" indexId="index" property="quesArray">
    <tr><td><li><em><b><bean:write name="item"/> </em></li></b></td>          
    <td><html:textarea property="quesIdArray" cols="50" rows="2" name="selectionCriteriaForm" onkeyup="limitTextarea(answer<%=i %>,5,50)" />          
    <br></td></tr>
    <% i=i+1;
    %></td></tr>          
    </logic:iterate>
    Pls help me on this.
    Thanx in advance.

  • Printing all text in a dynamic scrollable textfield

    Hi,
    I have search alot about solutions for solving the problem
    about trying to print all text in a dynamic Scrollable Text. There
    is no answer for this. So, is there a simpel way to print all the
    text in a dynamic scrollable textfield?
    Because the text is dynamic, there is possible that the text
    can be 1- 100 pages.
    Please help me out.
    [email protected]
    [email protected]

    Is there an easy way to determine the character count that is visible in a given multi-line text field when designing the form, so if I want to allow 500 characters, the text box I create is large enough for 500 characters?  Obviously I can just do a trial and error process using a cut and paste of 500 characters and testing it, but is there an easier way?

  • Displaying dynamically generated HTML

    Hi!
    Is it possible to display dynamically generated HTML-page by means of ITS?
    I want to write report in ABAP and generate HTML-page with report data, then display it on client side.
    Is it possible?
    Thanks!

    Hello,
    As long as it has a transaction code then probably yes.  Just use the webgui service.
    Edgar

  • HTML TextArea is a  JScrollPane in JEditorPane?

    Hi all,
    I'm trying to create an autofill facility for my application, to do this I am getting the components from the HTML document and converting them to their Java Swing counterpart.
    So for example <input type="text" name="example" /> would be a normal text input field on a HTML form, and its Swing conversion is a JTextField - this works as desired and it allows me to use the .settext() command to set the text on the HTML form - i.e. autofilling.
    My problem comes when I try to get the component for a HTML textarea, e.g. <textarea name="example"></textarea> - I would expect the Swing component to be a JTextArea, but the class it gets converted to is a JSrcollPane! This leads to a problem as I can't set the text of a JScrollPane as it is a container.
    Does anyone know how I might get around this problem so that I can set the text for the textarea? I've included my code below.
    Many thanks
    BBB
    import java.awt.event.*;
    import java.awt.*;
    import java.net.URL;
    import javax.swing.*;
    public class Tester extends JFrame{
        static JEditorPane pane = new JEditorPane();
        public Tester()
            try {
                pane.setPage( new URL("http://www.amray.com/cgi/amray/addurl.cgi") );
            } catch (Exception e) {
            this.getContentPane().add(new JScrollPane(pane));
            JButton b1 = new JButton("Auto Fill");
            this.getContentPane().add(b1,BorderLayout.SOUTH);
            b1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e)
                    for ( int i = 0; i < pane.getComponentCount(); i++ )
                        Container c = (Container)pane.getComponent(i);
                        Component swingComponentOfHTMLInputType = c.getComponent(0);
                        System.out.println(swingComponentOfHTMLInputType.getClass());
                        if ( swingComponentOfHTMLInputType instanceof JTextField ) {
                            JTextField tf = (JTextField)swingComponentOfHTMLInputType;
                            tf.setBackground( Color.yellow );
                            tf.setText("Auto Filled");
                        if ( swingComponentOfHTMLInputType instanceof JScrollPane ) {
                            JScrollPane ta = (JScrollPane)swingComponentOfHTMLInputType;
        public static void main(String args[]) {
            Tester app = new Tester();
            app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            app.setSize( 400, 400 );
            app.setVisible( true );
    }

    Hi Jim,
    Thanks for the suggestion, but I've already tried that and although it does work from a visual POV, when you then submit the form the data in the JTextArea isn't added - it just says the field is blank.
    Although, I'm not sure whether it's not working due to the method I've had to use to add the JTextArea: -
    JScrollPane ta = (JScrollPane)swingComponentOfHTMLInputType;
    JTextArea oTextArea = new JTextArea();
    oTextArea.setText("Hello World!");
    ta.setViewportView(oTextArea);I'm not sure if it's not working because I've had to use .setViewportView(); rather than .add(). If I use .add() then no changes are reflected on screen and the JTextArea isn't actually added.
    Any other suggestions?

  • Default text for html:textarea..

    Hi All.
    How to populate a textarea in struts(<html:textarea>) with some default text.
    Waiting for your suggestion in this regard.

    Why are you duplicating the answer after 2 days? The answer is already given. Just leave the thread as it is as long there are no unanswered questions from the topicstarter.

  • JEditorPane + html TEXTAREA + WRAP

    Hi, I have a simple program that uses a JEditorPane to create an html TEXTAREA.
    Supposedly the text in the TEXTAREA should be wrapped, and when I add READONLY, the text can�t be deleted. However, the wrapping and readonly don�t work�
    Here is the code:
    import javax.swing.*;
    import java.awt.*;
    public class Main extends JFrame {
        public Main() {
            String abc = "A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...";
            Container ct = getContentPane();
            JEditorPane ep = new JEditorPane();
            ep.setContentType("text/html");
            ep.setText("<body><tr><td class=one width=135>Test Criteria:</b></td><TEXTAREA WRAP=SOFT COLS=20 ROWS=2 READONLY>"
                       + abc + "</TEXTAREA></tr></body>");
            ct.add("Center", ep);
            setSize(400, 300);
            setVisible(true);
        public static void main(String[] args) {
            new Main();
    }Please help me out.
    Thanks.
    Hong Jiang

    As I understand it, JEditorPane's version of HTML is 3.2. Looking in the HTML 3.2 recommendation I don't see "wrap" and "readonly" as acceptable attributes for Textarea.

  • Can I dynamically load html from file, but do not stuck the UI

    I load my html from files.
    Use JEditorPane to setContentType("text/html"),
    use JEditorPane.read method to dynamically load html from file,
    the jeditorpane is add into a jdialog,
    when my application showing the dialog, the dialog was stuck,
    user can not click other UI component, I think it is not look dynamically
    So any other suggestion?
    You are appreciated.
    Thanks in advanced.

       yourDialog.setModal(false);

  • Struts "bean:write" in "html:textarea"

    Hi,
    i want to write a bean with bean:write to a html:textarea
    how can i do this?

    Hint:
    <html:textarea ...>
        <bean:write ... />
    </html:textarea>

  • Dynamic linking within TextArea component

    how can i include an MC or button inline within the HTML text
    of a TextArea component -- and also have that object link to an AS
    function? i want to have icons within the text of my TextArea that
    open pop-up windows within the Flash application (MC linkage).
    is this possible?
    is asfunction used? if so how?

    Well if you are still interested in using a text component
    instead of a Button the way you would go about this is using
    textWidth. Here's how I've done it before using a text / label
    whatever you want that shows text.
    // => Set our text we got from database
    myText.text = "This is the text I got from the DB";
    // => Validate it so that way we make sure we get right
    numbers
    myText.validateNow();
    // => Find out how wide our text really is.
    var textWidth:Number = myText.textWidth
    // => Reset the width of our text component and add 20 for
    a little buffer
    myText.width = textWidth + 20;
    Now my suggestion is if your going to be dynamically creating
    these on the fly from a database call you throw it into a method /
    class and have that do all the work for you so all you have to do
    is pass the text to it and it resizes itself based on the example
    above.

  • How to Load a SWF in Dynamically Loaded HTML

    Hello,
    I have a Flash movie with a multi-line text field that loads
    HTML text. As per the below Macromedia documentation I have swfs as
    images inside my HTML text.
    I'm trying to find a way to pre-load these swfs - if I do
    loadmovie to load the swf, when the html file is loaded will it
    need to reload the swf from scratch or will it take my loaded
    version? I'd love to show a "loading" message in the text as the
    swf was loading but am unsure how to do this now that I have the
    swf reference embedded in the html text.
    Any ideas?
    Thanks!
    Julia
    From the Macromedia documentation:
    Image tag (<img>
    The <img> tag lets you embed external JPEG files, SWF
    files, and movie clips inside text fields. The <img> tag has
    one required attribute, src, which specifies the path to a JPEG
    file, a SWF file, or the linkage identifier of a movie clip symbol.

    Thanks - your answer is exactly what I was looking for.
    I'm noticing that every swf I load via dynamic HTML is
    distorted - is there a way to prevent this? I can set the width and
    height of each swf in the HTML, which works ok, but then I run into
    a problem when I try and have a component item (like an accordion)
    included in the dynamic text field. It works properly, and the
    framing is sized correctly, but the guts are still skewed. I
    haven't been able to figure out why the swfs are being distorted in
    the first place.
    Any ideas?
    Thanks,
    Julia

  • How to dynamically generate HTML in Servlet without all the out.println?

    Since I am not sure whether this is a Java Servlet or JSP problem, so I will describe my situation. And hopefully someone can propose a good solution. I came from a PHP, so Java Servlet and JSP are still a little bit foreign for me.
    My problem
    My front end is a JSP page that essentially contains a form (let’s call it form1). The reason it is a JSP not a HTML is because I will need to load form data from the backend and display them in the form. Once the user submits the form, it will go to a backend Java Servlet (let’s call it servlet 1), which loads data from files according to user input. Then, I will need to dynamically create a new form (let’s call it form2) based on the data loaded from files. Once the user inputs and submits form2, another Java Servlet (servlet 2) will do more processing. That is the end of line. Both form1 and form2 require Javascript.
    My question is that since servlet 1 will need to dynamically create form2. I naturally will want a presentation control. Instead of doing out.println(“html code”), I want to use JSP and write direct HTML code. On the other hand, can JSP be used as a form action? So basically, in form 1, can I do <form action=”…/xxx.jsp”> I think I saw something like this, but I lack the comprehensive JSP knowledge to know for sure. More importantly, if hypothetically JSP can be used, how do I handle functions such as doGet(HttpServletRequest request, HttpServletResponse response), which is used in servlet1.
    Thank you,
    M

    no, servlets should not be used to generate a view, that is what a JSP is for. So let your backend servlet fetch the data, put it for example as attributes of the request scope (request.setAttribute()) and then forward control to a JSP that will generate the view, based on the information you stored in the request scope. That is the proper way of using servlets & JSPs; use servlets to invoke business logic classes, use JSPs combined with JSTL to generate the view. If you do it properly, you don't need ANY java code in your JSP.

  • Help regarding HTML Textarea in JSP

    I have a textarea in my JSP where if the text entered is </TEXTAREA> it considers it to be the code to end the Textarea.
    The code i have used is :
    <TEXTAREA cols="30" name="<%=fieldName + template.getFieldId()%>" ><%=fieldValue%></TEXTAREA>
    When the form is saved with the text ' </Textarea> abcd ' in the textarea then the page if retrived after saved is scrambled.

    You will want to escape those nasty < and > characters that are in your text.
    Turn them into &lt; and &gt; in your HTML and you should be ok.
    (plug time for JSTL and EL again)
    Using <c:out > tag in JSTL automatically escapes these nasty characters for you, unless you ask it not to.
    Struts provides a similar tag I believe.
    Good luck,
    evnafets

  • ERROR USING HTML textarea with Java String

    I have a form in HTML that has a textarea for input messages.
    When user press submit, a java servlet gets the information and stores it in a Database as a String.
    Later, I have a JSP thata retrieves that information from the database and put it as the value propertie of another textarea in the page so user can modify it if wanted, but I am having a hard time finding how to do so , because when I do the line:
    <textarea .....bla bla.... value=
    <%=some_string%>
    .....bla >
    and the some_string has more than one line ( e.g "\n" or "\r" caracteres ), I got an error when displaying the page. Can anyone help me with that please ???
    Thanks.

    here's my codes again for reference. hope it helps to rectify the matter
    // edit.jsp
    String search = (String)request.getParameter("txtSearch");
    String parameter = (String)"%"+search+"%";
    String sSQL = "select * from tblArticle where Title LIKE '"+parameter+"'";
    <%
    try {
    while(Rs.next()) {
    %>
    <tr>
    <td width="16%" height="157" align="center">Article:</td>
    <td width="88%" height="157"><textarea rows="15" name="txtArt" cols="86" value="<%= txtArt %>"></textarea></td>
    </tr>
    </table>
    <%
    // .....

  • Dynamic Text - HTML

    I have created a Dynamic text box and selected the "Render
    text as HTML" option. Right now all I am trying to do is get the
    bold tag to work, so in my test text box I have the following:
    <b>Bold</b>
    Not Bold
    When I do a ctrl-enter I don't get an HTML representation I
    just get the text as it is pasted here. This is a new empty
    document and is using Flash CS3 Professional.

    I saw this tutorial, thouht it may help:
    http://www.smartwebby.com/Flash/html_textbox.asp
    Sean

Maybe you are looking for