Validation of whitespace on textboxs in jsp

hi the following code help mi to validate if all my textboxes is blank anot but it doesnt help mi validate theres any white space or if the person just enter a space in the box
my form look smtg like this
<input type=textbox name="choice<%=i%>
so if i is =1 then it will look like the following
<input type=textbox name="choice1>
<input type=textbox name="choice1>
<input type=textbox name="choice1>
<input type=textbox name="choice1>
i will increase according and it varies and the number of textbok with the same name also varies.
The validation code to find blank textbos is written below but does any1 noe how to validate space?
can any1 help me add in the code as an example
var d=0;
for(var d=0;d< <%=i-1%>; d++){
var txtArray = eval("document.example.choices" + (d+1));
for (var h= 0; h < txtArray.length; h++) {
var val2 = txtArray[h].value;
if (val2 == ""){
alert("The choices"+" "+(h+1)+" "+"in question" +" "+(d+1)+" is not fill in."+" "+"Please fill in all the choices textboxes before submitting");
txtArray[h].focus();
return false; }
}

Hi i need help in this... its urgent
currently i just subscribe to a web hosting site and i need to start the private tomcat in the web server..
The followings are the instructions and i have follow them but i do not know how to create a web.xml file to store in the folder indicated for example a HelloServlet that im testing :
To setup servlet, you need to configure servlet into the file web.xml which needs to be placed in /var/www/html/WEB-INF directory.
www root directory or webapps:/var/www/htm
Classes directory located in: /var/www/html/WEB-INF/Classes/
There you will need to upload your Java class file.
Our default url-mapping for servlet is: /servlet/*
To check servlet in your browser: www.mydomain.net/servlet/HelloWorld
Jsp Files - Upload anywhere in /var/www/html
all the above steps are follow except the web.xml file which i suppose to write and store in the folder... but i actually try to write one but i still cannot load my servlet on the webpage... test on standalone tomcat works.
pls help its urgent!!!

Similar Messages

  • How to put data into textbox using JSP

    How can I put data into a textbox using JSP?
    This code prints to a html page but I want it inside an text area:
    // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
                    out.print("DIR\t");
                else if(type == FtpListResult.FILE)
                    out.print("FILE\t");
                else if(type == FtpListResult.LINK)
                    out.print("LINK\t");
                else if(type == FtpListResult.OTHERS)
                    out.print("OTHER\t");
                out.print(ftplrs.getName() +"<br>");
            }I have tried with the code below:
    <textarea name="showDirectoryContent" rows="10" cols="70">
    <%
           // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
    %>
                    <%= "DIR\t" %>
    <%            else if(type == FtpListResult.FILE) %>
                    <%= "FILE\t" %>
    <%            else if(type == FtpListResult.LINK)  %>
                    <%= "LINK\t" %>
    <%            else if(type == FtpListResult.OTHERS) %>
                    <%= "OTHER\t" %>
    <%            String temp = ftplrs.getName() +"<br>");
                  <%= temp > <br>
    %>
    </textarea>I get the following error:
    Location: /myJSPs/jsp/grid-portal-project/processviewfiles_dir.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:151: 'else' without 'if'.
    else if(type == FtpListResult.FILE)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:165: 'else' without 'if'.
    else if(type == FtpListResult.LINK)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:179: 'else' without 'if'.
    else if(type == FtpListResult.OTHERS)
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\processviewfiles_dir_3.java:193: ';' expected.
    String temp = ftplrs.getName() +"");
    ^
    4 errors, 1 warning
         at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
         at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
         at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
         at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:536)
    Please help???

    Yes indeed this works:
    <textarea name="showDirectoryContent" rows="10" cols="70">
    <%
           // Print out the type and file name of each row.
            while(ftplrs.next())
                int type = ftplrs.getType();
                if(type == FtpListResult.DIRECTORY)
    {%>
                    <%= "DIR\t" %>
    <%}            else if(type == FtpListResult.FILE)  {%>
                    <%= "FILE\t" %>
    <%}            else if(type == FtpListResult.LINK)  {%>
                    <%= "LINK\t" %>
    <%}            else if(type == FtpListResult.OTHERS) %>
                    <%= "OTHER\t" %>            
                  <%= ftplrs.getName() %>
    <%
    %>

  • How to "force" user to enter a valid value in a TextBox

    How can one create a TextBox in which the user is not able to leave (commit the value, change focus, or perform the action of another control) unless a valid value (the value to be committed) is displayed?
    The following is the best I've come up with so far.
    Good: It doesn't permit a value to be committed unless it is valid.
    Good: It doesn't permit the focus to be changed when TAB is pressed unless it is valid.
    Bad: It permits the user to perform the action associated with a button at any time.
    In the following code pressing on the button prints "I've been pushed", no matter the value of the TextBoxes. Can I stop this (in general, not for specific buttons)?
    class ValidTextBox extends TextBox {
      public-init var validValue:String = "";
      function isValid():Boolean {
        return (rawText == validValue);
      var isFocused = bind focused on replace {
        if (not focused and not isValid()) {
          requestFocus();
      override function commit():Void {
        if (isValid()) { super.commit(); }
        else {};
    var string1:String = "" on replace { println ("String1 = '{string1}'") };
    var string2:String = "" on replace { println ("String2 = '{string2}'") };
    def textbox1 = ValidTextBox { text: bind string1 with inverse; promptText: "String1: enter abc"; columns: 20; validValue: "abc"; }
    def textbox2 = ValidTextBox { text: bind string2 with inverse; promptText: "String2: enter def"; columns: 20; validValue: "def"; }
    def aButton = Button {
      text: "Push me";
      action: function():Void { println("I've been pushed!"); }
    Stage {
      scene: Scene {
        width: 250
        height: 300
        content: [ VBox { spacing: 10; content: [ textbox1, textbox2, aButton ] } ]
    }

    It sounds like you are looking for a concept of validation that groups items together. In days long gone Oracle used to have a product called Oracle Forms - that had field validation, record validation and block validation. So in your example if string1 and string2 were in the same persistable data object then the equivalent concept would be 'record validation'. The code in your button would say "if the record is valid print". A record is only valid if all its fields are valid.
    JavaFX really provides a 'GUI toolkit'. I think you are looking for a fairly advanced binding framework - a framework that builds on the concept of field level validation. You can approximate such a thing by creating a 'validation group' class. This class would be able to have nodes added to it and have an 'isValid()' function which only returns true if all the node items are valid.

  • How to display a tooltip for a textbox in JSP file

    I want to display a tool tip for a textbox when it gets focus in a jsp file.
    Any suggestion ?
    Thank you in advance

    I must think that the JSP is rendering HTML.
    so if you�re doing that then I would set
    <input type=text title="tool-tip-text-here" name="xxx">
    I think that should be it.
    hope it helps

  • Query about textboxes in JSP?

    hi friends? there is some problem with the textbox fields in jsp? if i want to add additional textfield on the page if there is in increase in attributes in database then how to do it? database is in excel

    hi,
    you could detect the string before you sent the string, check for the & symbol and replace it with something else, such as the html equivalent and then append it to the url and send it, on the other end read it and replace the symbol with the & to get it back without confusing the code. you would run into the same problems if the user enter = or possibly ? into the string, so try fixing it with a search and replace method.

  • Validating XML with its DTD in JSP

    Is there a way to validate an XML file with its DTD, using a JSP ???
    If YES, then HOW???
    I hope my question is clear enough.
    Please help!!

    Thanks "Jleech",
    I am using a textarea in a JSP to input for an XML file. The JSP transfers the file to Web-Server, which also has XERCES installed. My question is how can u Validate this transfered XML file with its DTD. My problem is I don't to how to include that Validation program in JSP.?
    Could you still help???

  • How to create dynamic Textbox in JSP

    I created dynamic Textboxes using javascript in JSP.But i want to give every textbox a unique name..But I dont know how to give unique name to all the textbox which are created dynamically.....Can u help me Please.............
    <script code="text/javascript">
    function dynam(val)
    var d= document.getElementById("Bottom");
    d.innerHTML='<table>';
    for(i=1;i<=val;i++)
    d.innerHTML += '<tr><td>Parameter</td><td><INPUT type="text" name="week"'+i+'size = 15></td>';
    d.innerHTML +='</table>' ;
    </script>in the above code."val" is the integer value passed while calling this function. "Bottom" is the id of <DIV> tag in my JSP page.
    My problem is : when i creating a text box. the Unique name of the textbox in not getting generated.All the text bok has the same name as "week",but i want the name to be as week1,week2,week3,.....etc
    Edited by: AnilTcs on Jan 21, 2009 1:31 AM

    Try this:
    d.innerHTML += '<tr><td>Parameter</td><td><INPUT type="text" name="week '+i+' " size = 15></td>';I have just changed the quotes around week. Hope this helps.

  • Dynamic Textboxes in JSP using struts

    Hi all
    I'm using JSP and Struts framework. I have two buttons Add row and delete row.(not submit buttons) on click i need to either generate or delete a row of textboxes. I able to do the same using javascript but the tag in that case is <input..>(normal HTML) and not <html:text> tag of struts.. Can i use the struts tag in jsp?? I tried but err... So any suggestions?
    A sample code would be of great help.. Im still a beginner in this ocean of Java!
    cya

    If the add/delete row buttons run in javascript, then you have to use the standard <input> tags.
    The struts <html:text> tag is a JSP tag that just generates an <input> at the end of the day anyway (filling in the attributes automatically though)
    As long as you name the controls consistent with what would have been produced by the struts tag, it should work perfectly well.

  • Tagid attribute in netui:textbox in jsp is not reflecting

    Hi,
    I included this netui tag in my jsp
    <netui:textBox dataSource="{actionForm.custId}" tagId="custTagId"></netui:textBox>
    But attribtue "tagid" doesnot seems to be reflecting in the html pages.
    thanks,
    shashi

    Tanya,
    This works well in a pageFlow. But it in the context of a portal it throws a JavaScript
    error saying that document[getNetuiTagName("myForm")][getNetuiTagName("age")]
    is null.
    Thanks,
    Anant
    "tanya" <[email protected]> wrote:
    >
    I'm not sure what you mean by "reflecting", but if you're referring to
    accessing
    it via javascript, see the following:
    http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conValidatingUserInput.html
    You'll end up having to do something like this:
    <netui:html>
    <netui:textBox tagId="age" dataSource="{actionForm.age}" onBlur="isValidAge();"/>
    </netui:html>
    And this would be the JavaScript function isValidAge:
    function isValidAge() {
    if(document[getNetuiTagName("myForm")][getNetuiTagName("age")].value
    <= 0)
    alert('Wrong Age');
    -Tanya
    "shashishekar" <[email protected]> wrote:
    Hi,
    I included this netui tag in my jsp
    <netui:textBox dataSource="{actionForm.custId}" tagId="custTagId"></netui:textBox>
    But attribtue "tagid" doesnot seems to be reflecting in the html pages.
    thanks,
    shashi

  • Insert web services result into textbox in JSP

    Basically, I had using HTML to create a textbox in the earlier:
    <input id="Destination" style="z-index: 140; left: 413px; position: absolute; top: 238px"
    type="text" disabled="disabled" name="Destination" />
    Then now I had using JSP to consume the web services:
    <%-- start web service invocation --%><hr/>
    <%
    try {
    if(request.getParameter("btn")!=null)
         org.tempuri.CheckTravelBooking service = new org.tempuri.CheckTravelBooking();
         org.tempuri.CheckTravelBookingSoap port = service.getCheckTravelBookingSoap();
    java.lang.String bookingID = request.getParameter("ID");
    // out.println("Result=" +bookingID);
         // TODO process result here
         org.tempuri.ArrayOfString result = port.checkBooking(bookingID);
    // out.println("Result="+bookingID);
    // for(int i=0; i<result.getString().size(); i++)
    {%>
    <table>
    <tr>
    <td> <%=result.getString().get(0)%></td>
    <td> <%=result.getString().get(1)%></td>
    <td> <%=result.getString().get(2)%></td>
    <td> <%=result.getString().get(3)%></td>
    <td> <%=result.getString().get(4)%></td>
    <td> <%=result.getString().get(5)%></td>
    <td> <%=result.getString().get(6)%></td>
    <td> <%=result.getString().get(7)%></td>
    <td> <%=result.getString().get(8)%></td>
    <td> <%=result.getString().get(9)%></td>
    <td> <%=result.getString().get(10)%></td>
    </tr>
    </table>
    <%
    } catch (Exception ex) {
         // TODO handle custom exceptions here
    out.println(ex.getMessage());
    %>
    <%-- end web service invocation --%><hr/>
    How should I insert my result in the web services to my textbox that had been designed in the earlier???

    If you separate the code into
    JSP - reserve only for HTML and front end logic
    Servlet - to communicate between JSP and Business Layer/Database Layer
    Business layer - to communicate with database layer
    the code will be more manageable, than putting all code in just one JSP file.
    The above structure is called Model-View-Controller MVC , if you study that what you are trying to do will be much easier.

  • Valid SELECT statement for use in JSP?

    Just starting to work with mySQL and JSP, is this a valid statement:
    String Query = "SELECT r.resumeID,r.userID,u.location FROM resumes r,resumeHolders u WHERE
    r.userID=u.userID AND u.location=" +City;
    City being a variable set earlier...

    Unless City is a number you will probably want to surrond your variable city with 's
    SELECT r.resumeID,r.userID,u.location FROM resumes r,resumeHolders u WHERE
    r.userID=u.userID AND u.location=\'" +City"\'";

  • Whitespace in XML-Style JSP

    Hi,
    I am having a slight issue with the XHTML content generated by a JSP. The output is stripped entirely of all whitespace, such that the content is all on one line. I have a request from one of our content writers to view the source "nicely". Oddly, in all of my searches for this problem, I have found people experiencing the opposite problem.
    Suppose I have a JSP like so:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
    <jsp:directive.page language="java" contentType="text/html;charset=ISO-8859-1"/>
    <html>
    <head>
         <title>A JSP Page</title>
    </head>
    <body>
         <table>
              <tr>
                   <td>Table Cell</td>
              </tr>
         </table>
    </body>
    </html>
    </jsp:root>The resulting output is:
    <html><head><title>A JSP Page</title></head><body><table><tr><td>Table Cell</td></tr></table></body></html>How can I get the output to have the same indentation as the source?
    I am using Tomcat 4.1.29.
    Thanks!

    Hi Syed,
    Try these links:
    <a href="http://www.javaranch.com/newsletter/Feb2002/xmljsp.html">Exploring JSP Documents (XML Style JSP Pages)</a> --> an excellent overview of the benefits of JSP Documents (XML Style JSPs) over standard JSP Pages.
    <a href="http://www.webmonkey.com/webmonkey/01/22/index3a.html?tw=programming">Intro to JSP</a>
    You can also try googling for "XML Style JSP"...
    Regarding books on JSP 2.1 and Servlet 2.5 -- I really can't believe that there are none available! Have you tried searching on amazon?
    HTH!
    -Vladimir

  • Creating dynamic textbox in JSP

    I am trying to create dynamic textbox.when i run this below JS ,I am getting two boxes only and then i nothing getting it displayed.The problem comes in the inner for loop.
    function DynamicBox(val)
                        alert("helloooo");
                         var d =document.getElementById("bottom");
                         d.innerHTML = '<table cellpadding="10">';
                        for(i=0;i<val;i++)
                                d.innerHTML += '<tr><td><INPUT type="text" name="week'+i+'" size=8 >  </td><td><INPUT type="text" name="deliverable'+i+'" size=30>  </td>';
                              for(j=1;j<=<%=parameter.length%>;j++)
                                       <% int m=0;%>
                                      d.innerHTML+='<td><INPUT type="text" name="'+<%=parameter[m]%>+i+'" size=10></td>';
                                      <% m++; %>
                                 d.innerHTML +='</tr><br />';
                            d.innerHTML+='</table>';
                    }In the above code,val is the number of rows to be created.Bottom is the id of the <div> tag.parametr is a String array.The values are coming from database.

    move the <% int m=0;%> out of the loop.. You have place it in the loop, causing it to be initialize to be 0 each time the looping occurs.
    Place <% int m=0;%> below the line: d.innerHTML = '<table cellpadding="10">'

  • URGENT!!! can I borrow a valid jserv.properties file for a JSP application ?

    Hi there !
    I'm running Oracle enterprise edition on NT with oracle http server under apache.
    I created a JSP application using jdeveloper
    and deployed it to the web server.
    Now I'm still getting getting nullPointer exceptions after I have modified the jserv.properties file according to the documentation
    Can someone give me a file that is working for her/him under the above described circumstances ?
    Many Thanaks in advance
    Tony
    null

    laredotornado wrote:
    Hi,
    This might not be a JSF question, but I thought I'd start here as I'm building a JSF application. Upon startup of my Weblogic 9.2.2 server, I see these error messages
    log4j:WARN No appenders could be found for logger (org.apache.myfaces.webapp.StartupServletContextListener).
    log4j:WARN Please initialize the log4j system properly.
    One complication, my log4j.properties file is actually called "my.properties" (bizarre company reason). Is there somewhere in my faces-config.xml file or an equivalent where I can indicate what log4j properties file I'd like to use?Your company policy is to use non-standard names so that things must be configured manually? Interesting.
    In the past people created a servlet those sole purpose was to configure log4j in the initialization sequence and then do nothing.

  • How to do  validation in jsp using javascript

    how to do validation in jsp using javascript

    The same way you do with any HTML page.
    Catch the onclick/onsubmit event, do your validation in javascript and then allow/cancel the action as required.
    However this is javascript validation only - javascript can never call JSP code.

Maybe you are looking for

  • How to upload and edit an eps file

    Hi all, I have just downloaded an eps file from shutterstock and they given me this free trial idea with adobe but unfortunately i have got no idea how to upload my file and edit it and save it as a jpg file for further work. can anyone help me pleas

  • Currency converting in 5 decimal place, time of posting in foreign currency

    Hi I am facing one problem at the time of posting of advance with bank charges in foreign currency USD. While i am trying to post advance to vendor with T code - F-48 with USD currency i mention the exchnage rate 51.56 , bank charges 500 in local cur

  • Account disabled

    I had an un-authorized purchas on my account a couple of moths ago. I disputed it and we're good. Now when I try to make another authorized purchase the iTunes store tells me my account is disabled even though I reset my password. please help

  • Error during date comparing

    Hi , i have situation , where i have to find a date between two dates i used below filter condition, but i get error (TO_DATE(PLAYER_MONTHLY_SUMMARY.CURRENT_MONTH, 'DD-MON-YYYY') BETWEEN TO_DATE('01-MAR-2012', 'DD-MON-YYYY') AND TO_DATE('31-MAR-2012'

  • How could I fix a podcast video that only plays the audio?

    My series of videos submitted to itunes podcast play fine except one, that only the audio plays but no video, how could I fix this?