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

Similar Messages

  • Help Regarding playing slideshow in jsp

    HI,
    In my project i want to do the slide show of the uploaded photos.
    Im saved the image links in the database and tried to pass those values to the slide show array.
    But it s not working properly
    Im using the following javascript and jsp codings:
    <%@ page import="java.sql.*,java.io.*,java.util.*,java.util.Date" %>
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    var browserName = navigator.appName;
    var browserVer = parseInt(navigator.appVersion);
    var browserOK = (((browserName == "Netscape") && (browserVer >= 3)) ||
         ((browserName == "Microsoft Internet Explorer") && (browserVer >= 4)));
    var slideURL;
    var slideDelay = 2000;
    var curSlide = -1;
    var curTimeout;
    function showSlide1(name1) {
    slideURL = Array(name1);
    showSlide();
    function showSlide() {
         if (browserOK) {
         curSlide = ((curSlide + 1) % slideURL.length);
              document.images["slideImg"].src = slideURL[curSlide];
              curTimeout = setTimeout("showSlide()", slideDelay);
         } else {
              alert("This page requires Netscape 3.0+ or IE 4.0+");
    function goNext() {
         if (browserOK) {
              clearTimeout(curTimeout);
              showSlide();
    function goPrev() {
         if (browserOK) {
              clearTimeout(curTimeout);
              curSlide = (((curSlide - 2) + slideURL.length) % slideURL.length);
              showSlide();
    </SCRIPT>
    </HEAD>
    String name=(String)(session.getAttribute("theName"));
    Connection con=null;
    Statement st=null;
    String sql=null;
    ResultSet rs=null;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:foto");
    st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    sql="select * from album_bookmark where username='"+name+"'";
    rs=st.executeQuery(sql);
    while(rs.next())
    //out.println(rs.getString(2));
    }catch(Exception ert){out.println(ert.toString());}*/
    %>
    <BODY ONLOAD="javascript:showSlide1('rs.getString(2)');">
    <CENTER>
    <IMG NAME="slideImg" SRC="" width="150" height="150">
    <BR><BR>
    <INPUT TYPE="BUTTON" VALUE="<< Previous Slide" onClick="goPrev()">
    <INPUT TYPE="BUTTON" VALUE="Next Slide >>" onClick="goNext()">
    </CENTER>
    </BODY>
    </HTML>
    Can u tell how to do this and where im did mistake?
    thanx in advance

    Is this JSF code?
    Besides of mixing up business code in presentation code, i thing you are missing some jsp start tags, because ....
    (for example)
    </SCRIPT>
    </HEAD>
    String name=(String)(session.getAttribute("theName"));
    Connection con=null;

  • 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.

  • TEXTAREA in JSP dosen't work

    TEXTAREA in JSP dosen't wrap to next line and I use the following syntax.
    <input type='textarea' name='code' rows='2' cols='30' style='width: 180px;height:30px'>
    when I type it keep wraping in the first line and dosen't go to 2nd line at all.

    The same syntax, I tried in a seperate html file it works.
    <input type='textarea' name='code' rows='2' cols='30' style='width: 180px;height:30px'>
    But, it dosen't work in my jsp? If I use your syntax in my JSP, still not working?

  • Conditional HTML in a JSP page?

    I've been scouring the help and web for about 2 hours and haven't found a way to do this yet.
    What I'm trying to do is to conditionally generate attributes to a html tag via JSP, but everything I've tried (even stuff that's valid JSP) won't pass the JDeveloper HTML checks and it won't compile the JSP page.
    Specifically, I'm trying to add a bgcolor attribute to a <tr> tag if conditions are met in data in the row, but everything I've tried to get the added data in the tag results in some error.
    I've tried something like this in the HTML:
    <tr <%= color %> >
    and this from the java side:
    if (rowCont > 20) {
    out.prinln("<tr bgcolor=\"#c0c0c0\">);
    else {
    out.prinln("<tr>");
    Both methods result in lots and lots of HTML errors and JDeveloper won't even compile the page. The hmtl way resutls in "name expected" errors, and the java way results in a bunch of "end tag doesn't match start tag" errors.
    Any clues on ways to do this?
    Thanks

    Can you send me a larger snippet of code from your JSP? I do pretty much the exact same thing in all of our JSP's in our app. If you have a uix:form tag, you'll need to wrap all html inside uix:rawText tags.
    String colText = "class=\"OraTableCellText\" style=\"border-left:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC\"";
    <td <%=colText%> >Text here </td>
    <td <%=colText%> >More Text </td>
    -Teri
    [email protected]

  • How to call HTML page through JSP ?

    i want to know Hw to call Automaticly a HTML page through JSP.
    example :-
    have u seen yahoo login wen u put your ID & pass & Clock on login button it will chack ID & pass in the database & if it is correct then It will call A Mail Home Page.
    that's same i want to do.
    i have a jsp page which chacks the userID & Pass & call the first.html page
    but i dont know how to call html page automaticly.
    Any one can help me
    what i think is this
    tell me is it right or not
    suppose i have made a variable
    String add = "first.html"
    after chacking userID & pass
    if(idpass == true)
    add;
    if(idpass == false)
    erre;
    it will work or not pl tell me

    If you do the redirect with javascript, the user cannot resubmit his login when he presses the refresh button. When he does press refresh, he only refreshes the redirect, not the form post that was before it. When he presses back the redirect will also kick him back in stead of going back to the login page. A simple javascript redirect page would look like this:
    <html>
    <body onload="document.location.href='myhtmlpage.htm';">
    </body>
    </html>But that is only if you care about resubmits of course.

  • How to upload an html file using jsp and jdbc

    Hi,
    im trying to upload an html page using JSP and jdbc. but of no success.
    my aim is to keep some important html pages in the database.the file size can vary.the file has to be selected from a local machine (through the browser) and uploaded to a remote machine(where the databse resides).
    any help/sample code or pointer to any helpful link is appreciated.
    thanks in advance
    javajar2003

    When uploading a file, I use a byte array as a temporary buffer..
    So, you should then be able to store the byte array in the
    database as binary data.
    example>
    //Temporary Buffer To Store File
    byte[] tmpbuffer = new byte[860];
    //Some Code To Upload File...
    //File Should Now Be In Byte Array
    //Get DB Connection and execute Prepared Statement
    Connection con=//GET DB CONNECTION;
    String sql=insert into TABLE(page) values(?);
    PreparedStatement ps=con.prepareStatement(sql);
    ps.setBytes(1,tempbuffer);
    ps.executeUpdate();
    //Close PS and Free DB Connection
    ..... and this method looks like you dont even have
    to store the file in a byte array, you can just give
    it the input stream.
    ps.setBinaryStream(int, inputStream, int);
    You may have to make several attempts at this. I have
    uploaded a file and temporarily stored it in a byte array,
    but have never from there stored it in the DB as binary
    data.. but this looks like it'll work.
    Good Luck!

  • Help regarding ABAP and ABAP Objects

    Dear all,
    I am very new in abap and abap objects. But i have some expr. in other language..specialy development. Right now i am working for srm module...So i want to move my self into abap object and specialy in workflow...Please provide me help regarding this...along with the starting point for this.
    Best Regards
    Vijay Patil

    hi
    Object Oriented prg
    A programming technique in which solutions reflect real world objects
    What are objects ?
    An object is an instantiation of a class. E.g. If “Animal” is a class, A cat
    can be an object of that class .
    With respect to code, Object refers to a set of services ( methods /
    attributes ) and can contain data
    What are classes ?
    A class defines the properties of an object. A class can be instantiated
    as many number of times
    Advantages of Object Orientated approach
    Easier to understand when the system is complex
    Easy to make changes
    Encapsulation - Can restrict the visibility of the data ( Restrict the access to the data )
    Polymorphism - Identically named methods behave differently in different classes
    Inheritance - You can use an existing class to define a new class
    Polymorphism and inheritance lead to code reuse
    Have a look at these good links for OO ABAP-
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com.
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Hope this helps
    if it helped, you can acknowledge the same by rewarding
    regards
    ankit

  • Need help regarding converting text to Lines and Arcs.

    In my program i have text.Lets say the text is JAVA.
    Now i need to group that text(JAVA) in the form of line and arcs.
    Its like organizing lines and arcs and make it looks like a text(JAVA).
    Can we have such a possibilities to do that?
    Please help regarding this!!
    Thanks in Advance.
    Boopathy.

    Have a look at TextLayout class (http://java.sun.com/javase/6/docs/api/java/awt/font/TextLayout.html)
    Graphics2D g = ...;
    Point2D loc = ...;
    Font font = Font.getFont("Helvetica-bold-italic");
    FontRenderContext frc = g.getFontRenderContext();
    TextLayout layout = new TextLayout("This is a string", font, frc);
    Shape shape = layout.getOutline(null);
    Edited by: AlexeyUshakov on Sep 29, 2008 8:46 AM

  • Need Help Regarding JAVA BEAN

    Is any one tell me that JAVA BEAN only used in WEB or also you in Desktop applications???? and aslo tell how i implement Java class and use JAVA BEAN. I need help regarding above matter
    thanks in advance
    Rehan MIrza

    Here is a good link that indicate that JavaBean is not only for applets
    http://java.sun.com/docs/books/tutorial/javabeans/whatis/beanDefinition.html
    quote:
    The JavaBeans API makes it possible to write component software in the Java programming language. Components are self-contained, reusable software units that can be visually composed into composite components, applets, applications, and servlets using visual application builder tools. JavaBean components are known as Beans.
    Francois

  • 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.

  • 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.

  • Can't create dynamic html elements with jsp????? important

    Hi All,
    I am having problem creating dynamic html elements with jsp tags, i have tried to use EL and java scriplet, both of them don't work.
    i am trying to create dynamic menu in my "rightMenu.jspf", based on, if user has logged in or not.
    some like this!
    <jsp:if test ="${validUser == null}">
    some simple text menu here
    </jsp:if>
    but it is not working. it simply loading all and images with in statement, regardless of whether user has logged in or not. i think some how if statement is not working properly.
    "validUser" is a session bean, which is not creating at this point, it will created when user will log in successfully. and also this session bean does not exist at the page, where i am trying to check that .
    Is there any way to create dynamic values in jsp. It is really important, is there any body who help me in this matter. i would be really grateful.
    zaman

    hi jaspre,
    thanks for replying me. you know what, is it not something wrong with web.xml file. i remember once, i deleted some from there, a property with "*.jsp". i can't remember what exactly was it though.
    all if statements works on files ending with extension ".jsp" but don't work only on with extension ".jspf". there must be to do with this.
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <servlet>
    <servlet-name>ValidateServlet</servlet-name>
    <servlet-class>ValidateServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ValidateServlet</servlet-name>
    <url-pattern>/ValidateServlet</url-pattern>
    </servlet-mapping>
    <servlet>
    <servlet-name>dwr-invoker</servlet-name>
    <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>true</param-value>
    </init-param>
    <init-param>
    <param-name>pollAndCometEnabled</param-name>
    <param-value>true</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
         <welcome-file>
    main.jsp
    </welcome-file>
    </welcome-file-list>
    </web-app>
    if any one can figure it out. i would be grateful.
    zaman

  • HTML Comment Vs JSP Comment

    HTML Comment : <!-- Comment -->
    JSP Comment : <%-- --%>
    1) What is the different between HTML Comment and JSP comment.
    2) How the web container will treat these two comments??
    Regards
    Dhinesh

    Hi,
    JSP comments are used for documenting JSP code and are not visible client-side (using browser's View Source option) where as HTML comments are visible.
    cheers,
    k

Maybe you are looking for

  • TS1741 I cannot get the remote app for Apple tv work on either my iPad or iPhone. Home sharing is "on". Any ideas?

    Why won' remote app for Apple tv work on my iPad or iPhone?  Home sharing is turned on.

  • SELECTION VARIABLE : DROPDOWN

    Hello gurus, Can I use dropdown WEBITEM for selection variable. I mean instead of selection screen for variable, can I use dropdown in the web report..? Thanks, Raj..

  • ME 8 SDK on Mac OS X?

    I see this was asked a while back (Is the Java ME 8 SDK only for Windows?), but since this was several months back, is there any news whether there will be a Mac OS X version of the ME 8 SDK? Thanks, Kevin

  • DVD Player has gone 'walkabout'

    I tried to play a DVD on my flat panel imac yesterday and discovered that the entire DVD player software has disappeared. There is no logical explanation for this, and I must presume that the software has been accidentally deleted. I tried loading th

  • Perspective "SAP UR Themes" is not visible

    Hi, I have downloaded NWDS Theme editor from URL below. https://www.sdn.sap.com/irj/sdn/index?rid=/library/uuid/502e9e64-585e-2c10-b7b6-b3ba1214f06e I followed step-by-step guide to install it. I am using NWDS 7.0.18. I copied plugin folders into "C: