Java script with struts html tag

the code show above is the main problem in the body of the function check() i just want to have a logic if the USERNAME is empty then it should alert("empty") if the name contains any spaces then it should alert("spaces are there")
can u help this out
<head>
<script language="text/javascript">
function check()
</script>
</head>
<body>
<html:form action="somename" ondbclick="check()">
USERNAME:<html:text property="username"/>
<html:submit/>
</html:form>
</body>

<html:form action="somename" ondbclick="check()">why do you plan to check it on double clicking the html form? what if the user doesn't do a double click?!
Maybe you could check it on the "onblur " event for the textbox. ->
<html:text property="username" onblur="javascript:check();"/>If you are unsure about how to work on the javascript function (because I didnt exactly understand your query :) ) then just to get you started...
function check()
         if(document.forms["0"].username.value == "")
             alert("Empty textbox!");
         //put code for checking spaces
}but do a little googling for the rest..
And if I have entirely misread your query, then please clarify...

Similar Messages

  • Wls 8.1 sp2: weblogic.jspc complains about struts-html tags

              Hi,
              I am trying to compile jsps with weblogic.jspc, which use struts' html tags. However,
              the compilation fails with the following message:
              [java] Translation of /views/viewPageBody.jsp failed: (line 3): Error in using
              tag library uri='/tags/struts-html' prefix='html': The Tag class 'org.apache.struts.taglib.html.BaseTag'
              has no setter method corresponding to TLD declared attribute 'server', (JSP 1.1
              spec, 5.4.1)
              I opened the BaseTag class from the struts jar and found the setter exists for
              the attribute 'server' of html tld. So does the property 'server'. The property
              'server' is a string and the parameter in the setter is a string. I read about
              the jspc errors in wls 8.1 about the setter parameter being of different type
              than the property. However, that is not the case here. I tried using both Sun's
              and BEA's jdk. None of them help. Btw, there is another attribute mentioned in
              the html tld, which is 'target'. The compiler doesn't complain yet about this.:(
              Also, I happened to compile other apps which have struts logic tags.
              My environment:
              OS: Win2k sp3
              WLS: 8.1 sp2
              JDK: Sun's 1.4.2 sp4 / Bea's 1.4.1 sp5 (tried both)
              Ant: 1.5.3 (I had an issue earlier with ant until I found that Bea officially
              without any mention supports only ant 1.5.3.)
              I would appreciate any help in this regard.
              Thanks,
              Abbas
              

              What version of Struts are you trying to use?
              Are you certain you're not encountering a different instance of that class in
              an unexpected location in your classpath?
              "Abbas" <[email protected]> wrote:
              >
              >Hi,
              >I am trying to compile jsps with weblogic.jspc, which use struts' html
              >tags. However,
              >the compilation fails with the following message:
              >
              >[java] Translation of /views/viewPageBody.jsp failed: (line 3): Error
              >in using
              >tag library uri='/tags/struts-html' prefix='html': The Tag class 'org.apache.struts.taglib.html.BaseTag'
              >has no setter method corresponding to TLD declared attribute 'server',
              >(JSP 1.1
              >spec, 5.4.1)
              >
              >I opened the BaseTag class from the struts jar and found the setter exists
              >for
              >the attribute 'server' of html tld. So does the property 'server'. The
              >property
              >'server' is a string and the parameter in the setter is a string. I read
              >about
              >the jspc errors in wls 8.1 about the setter parameter being of different
              >type
              >than the property. However, that is not the case here. I tried using
              >both Sun's
              >and BEA's jdk. None of them help. Btw, there is another attribute mentioned
              >in
              >the html tld, which is 'target'. The compiler doesn't complain yet about
              >this.:(
              >Also, I happened to compile other apps which have struts logic tags.
              >
              >
              >My environment:
              >OS: Win2k sp3
              >WLS: 8.1 sp2
              >JDK: Sun's 1.4.2 sp4 / Bea's 1.4.1 sp5 (tried both)
              >Ant: 1.5.3 (I had an issue earlier with ant until I found that Bea officially
              >without any mention supports only ant 1.5.3.)
              >
              >I would appreciate any help in this regard.
              >
              >Thanks,
              >
              >Abbas
              

  • Java Script With XE

    hi Expert,
    Can You Tell Me how to use Java Script With XE.
    Thanks
    Manoj

    Manoj.
    By the term "Use JavaScript", do you mean how to include JavaScript functions on your page(s) or are you looking for help in what JavaScript can be used for and how to add onclick, onchange events to form elements?
    If it is the former, there are several ways to include JavaScript onto your pages:
    1. Edit your page in the APEX Builder and place the normal syntax into the HTML Header Section i.e
    <script language="JavaScript">
    function hellWorld()
    alert ("Hello World");
    </script>2. Check out this article on how to link in File System based Javascript files: http://djmein.blogspot.com/2007/01/reference-javascript-from-file-system.html
    I hope that gets you started.
    Let me know if you need any more help.
    Duncs
    http://djmein.blogspot.com
    As a courtesy, please remember to mark correct or helpful responses accordingly :)

  • Give some refrence to learn Java Script with HTML5lo mates,

    Hello mates,
    Can anybody please prvodi me a good refrence to learn java script with HTML5. Yes, i am new to HTML5 and Java.
    Anybody have a good refrence.
    Please Share.
    Thanks

    Sorry for misspell in thread heading.

  • Including java script in struts

    Hii All,
    I wanted to use some java script function on onclick of button. like on click on calendar image i should invoke the cal control writtern in java script.
    Its a pure struts application. can any1 tell me how to include java script in struts ?

    it depends on the javascript file you are using as to how you are going to have to do it.. but I would imaging you will have to include the js file like this.
    <script type="text/javascript"
         src="<c:out value='${pageContext.request.contextPath}'/>/scripts/newCalendar/calendar.js"></script>then on how to call the javascript from the onclick it will completely depend on the actual calendar script.

  • Coverting java script site to html in dreamweaver

    I designed a site by keeping java script (instead of html) as default in the opening page of dreamweaver cs3. How do I convert to html without redoing the same?
    sasi

    If you're asking how to convert your JS page to HTML or XHTML document type, go to Modify > Page Properties > Title/Encoding and select the appropriate document type.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • How can I evaluate if a collection is empty or not with struts logic tag?

    How can I evaluate if a collection is empty or not with struts logic tag?
    I tried with logic empty tag. but the tag evaluated if a collection is null or not.
    I would like to do like this below.
    List list = new ArrayList();
    set(list);
    <logic:XXXX name="someForm" property="list">
    The list size is 0.
    </logic>thanks in advance.

    U can use :
    <logic:present name="urform" property="urlist">
    </logic:present>
    to check "urlist" is empty or not

  • Need help with Java script calling an html page

    Hello -
    I have a bunch of web pages, that call a java script called "header.js". The "header.js" puts a header on the top of each web page. In the Java script, I have a gif (picture) that displays a logo and if you click on it, it will send to you a different website.
    I'd like to replace this gif with an actual web page. So, the "header" would actually be a web page and not some gif.
    Below is a snippet of the code and I'd like to replace the highlighted section with a web page called "header.html". I don't even know if this is possible.
    Can anyone tell me what I need to do? I know pretty much nothing about Javascripting so please be as detailed as you can. Thanks!
    /* Common header across all pages... */
    document.write('            <div id="header" class="clearfix">');
    document.write('                            <div id="left" class="float_left">');
    document.write('                                            <div id="logo"><a href="http://www.xyz.com/" onclick="window.open(this.href);return false;" onkeypress="window.open(this.href);return false;" target=_blank><img src="/images/xyz.gif" width="105" height="75" alt="" border="0" /></a></div>');
    document.write('                                            <div id="mainNav" class="clearfix"> ');
    document.write('                                                             <ul>');
    //document.write('                                                                         <li id="nav_controls"><a href="controls.html">Controls</a></li>');
    document.write('                                                                              <li id="nav_motion"><a href="motion.html">Motion</a></li>');
    document.write('                                                                              <li id="nav_sensor"><a href="sensor.html">Sensor</a></li>');
    document.write('                                                                              <li id="nav_encoder"><a href="encoder.html">Encoder</a></li>');
    document.write('                                                                              <li id="nav_system"><a href="system.html">System</a></li>');
    //document.write('<!--                                                                  <li id="nav_logs"><a href="#">Logs</a></li> -->');
    document.write('                                                             </ul>');
    document.write('                                            </div>');
    document.write('                            </div>');
    document.write('                            <div id="right" class="float_left">');
    document.write('                                            <div id="controls">');

    Well, the problem with this is that I'm not an expert on SSI and I really know nothing about javascripting...so I'm afraid of breaking the whole web site and also having to modify all the web pages that call this header.
    I'll have to read up on server side include...cause I don't know much about it.
    If I could do what I want with this "header.js", it would be a lot easier.

  • Action listener for struts html tag

    hi i am doing a project using sturts. I have used struts HTML Select tag with a collection of values in select box. now i want to write an actionlistner for that select...ie if i select any value from the select list it should do some action like take me to different page...can anyone tell me how can i do that...
    Thanks

    Soultech, I think you're being a bit harsh. Struts is a valid topic on this forum as it is a java framework related to JSP.
    However having said that, the question does show a basic misunderstanding of JSP technology.
    JSP = Java SERVER Pages. Java code only runs on the server.
    All that gets sent to the client (browser) is an HTML file.
    You can not write java action listeners to run and respond to events on the client.
    For any client side interaction you will have to use javascript (which is NOT java) - probably an onclick/onchange event - the same as any other web page.
    However you can only run javascript code from such events.
    To run java again you have to submit a request to a server - normally done by submitting a form.

  • Struts Html tag problem in Weblogic 8.1

    Hi
    I am using weblogic8.1 Application server
    I have written a simple web application in struts that accepts
    username and password in "login.jsp" and corresponding "bean" ActionForm
    for the same.
    Below are my application source files......
    login.jsp
    <%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <html:html>
    <head>Struts Test</head>
    <body bgcolor="#E6F1FC">
    <html:form action="login.do">
    <table>
    <tr>
    <td><html:text property="uname" value=" "/></td>
    <td><html:submit>SUBMIT</html:submit></td>
    </tr>
    </table>
    </html:form>
    </body>
    </html:html>
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
    </web-app>
    struts-config.xml
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
    <form-beans>
    <form-bean name="LoginFrom" type="com.nit.StrutsEx.LoginFrom"/>
    </form-beans>
    <action-mappings>
    <action path="/login" type="com.nit.StrutsEx.LoginAction" name="LoginFrom" validate="false"
    input="/login.jsp">
    <forward name="success" path="/success.jsp"/>
    </action>
    </action-mappings>
    <message-resources parameter="ApplicationResource" null="false"/>
    </struts-config>
    ActionForm
    package com.nit.StrutsEx;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.*;
    import javax.servlet.*;
    import java.io.*;
    public class LoginForm extends ActionForm
    private String uname=null;
    public void setUname(String uname){
    this.uname=uname;
    public String getUname(){
    return this.uname;
    public void reset(ActionMapping am, HttpServletRequest req) {
    this.uname=null;
    public ActionErrors validate(ActionMapping am,HttpServletRequest req)
    System.out.println("I am in Validate");
    return null;
    ActionServlet
    package com.nit.StrutsEx;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import javax.servlet.*;
    import java.io.*;
    public class LoginAction extends Action
    public ActionForward execute(
    ActionMapping am,
    ActionForm af,
    HttpServletRequest req,
    HttpServletResponse res) throws ServletException , IOException
    return am.findForward("success");
    My application runs well under tomcat but when i deploy it on Weblogic 8.1 it gives following error
    Compilation of 'E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java' failed:
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:151: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 4:
    <html:html>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:168: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 8:
    <html:form action="login.do">
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:203: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 13:
    <td><html:submit>SUBMIT</html:submit></td>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:216: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 13:
    <td><html:submit>SUBMIT</html:submit></td>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:226: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 16:
    </html:form>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:235: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 18:
    </html:html>
    Full compiler error(s):
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:151: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int0 == BodyTag.EVAL_BODY_BUFFERED) { //[ /login.jsp; Line: 4]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:168: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int1 == BodyTag.EVAL_BODY_BUFFERED) { //[ /login.jsp; Line: 8]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:203: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int2 == BodyTag.EVAL_BODY_BUFFERED) { //[ /login.jsp; Line: 13]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:216: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int2 == BodyTag.EVAL_BODY_BUFFERED) out = pageContext.popBody(); //[ /login.jsp; Line: 13]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:226: cannot resolve symbol
    symbol : method doAfterBody ()
    location: class org.apache.struts.taglib.html.FormTag
    } while (_html_form0.doAfterBody() == IterationTag.EVAL_BODY_AGAIN); //[ /login.jsp; Line: 16]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:235: cannot resolve symbol
    symbol : method doAfterBody ()
    location: class org.apache.struts.taglib.html.HtmlTag
    } while (_html_html0.doAfterBody() == IterationTag.EVAL_BODY_AGAIN); //[ /login.jsp; Line: 18]
    ^
    6 errors
    Wed Jul 25 17:06:07 GMT+05:30 2007
    Please reply the solution

    I don't know about that, but I am using MyFaces and tomahawk with WLS8.1 sp5 jdk1.4.2_05 and it works fine.
    I do remember getting such an error when I moved from Sun RI to MyFaces and all I can recall is that it was a commons library mismatch problem or some classpath problem...

  • Can I use java script with iWeb?

    I am quite pleased with iWeb for my web requirements, commercial and private, but I need to insert java script and don't know how or if iWeb accepts it.

    All custom code, including JavaScript, is pasted in the HTML Snippet.
    Read this : Using the HTML Snippet
    Everything you paste there, is your responsibility.
    iWeb happily publishes your code, whether it works or not. If not, mend it.
    See examples here :
         http://www.wyodor.net/_Demo/Fancy/Dynamic_Text.html
         http://www.wyodor.net/_Demo/html5/BlowUp.html
         http://www.wyodor.net/mfi/Maaskant/How_To.html
         http://www.wyodor.net/mfi/cultureclub/Movies.html
         http://www.wyodor.net/mfi/roodhout/How_To_Do.html
    You may have to learn HTML, CSS, JavaScript, AJAX, DOM and how iWeb creates its pages. Especially that.

  • Java scripting with textarea?

    Hello,
    I am trying to read values passed by a servlet from an html form using java scripting. Here is the code:
    document.MainForm.textareaInfo.value = "<%= (String)session.getAttribute("textareaInfo") %>"
    This code works if the info entered in the textareadInfo field has one line with no carriage return.
    How can assign value to textareaInfo field contains multi-line string with carriage return?
    Thanks in advance.

    Hi,
    replace all "\r\n" (carriage return) in the string with "\\r\\n", so that it appears as "\r\n" in javascript.
    In jdk 1.4, you can use((String)session.getAttribute("textareaInfo")).replaceAll ("\r\n", "\\\\r\\\\n")

  • Java script with java

    sir i have seen that java 1.6 mustang version is supporrting java script
    if it is so please any one can help me on how to make my JEditorPane
    to support java script
    not only to jEditorPane but to any other swings component
    i tried in all ways please can any one give me this help

    Hello Farhan,
    The OP stated that there is no condition on the process. In this case, I believe only 'SUBMIT' will cause the process to be fired.
    "you can put anything in the string of the doSubmit."Well, you can do that, but it will have an effect only if you are using the REQUEST variable to condition a process. Otherwise, nothing will happen, and you want even receive an error message, because no error actually exist (as I believe happened with the OP case).
    Regards,
    Arie.

  • How to do Front End Validation for JSP Forms using Java Script with 9iJD...

    How to do Front End validation using 9iJD. Any wizard is there. We need to do the val. using Java Script. If its not available, please include that in the Production Release.

    Thanks a lot. When is the Production Release is scheduled. Please tell us whether itll be available for Free Download. Bec, we couldnt buy. Bec, if its working fine with all the options without any bug only, we can ask our company to buy 9iJD by stating the advantages. Just explain us.

  • Java script with jsp

    hello friends,.
    please help me !! May i know how to retrieve values from list box in java script to jsp and store them in database..i am doing a project Employee Management system....
    please give me ideas .....

    thank you very much sir.......
    i have a combo box in java script having employee skills, if the employee select his skills and click on submit, the values should be stored in the database of the particular employee through JSP..
    the code that i have did is...
    <%
    String s1=(String)session.getAttribute("eid");
    String s2[]=request.getParameterValues ("menu2");
    int i=0;
    %>
    <%
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:empl2");
    PreparedStatement prep=con.prepareStatement("update skill(menu2) values(?) where eid=?");
    // prep.setString(1,s2);
    prep.setString(2,s1);
    i=prep.executeUpdate();
    con.close();
    catch(Exception e)
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body >
    <center><h4><u> Employee Assessment Application</u></h4></center>
    <%
    if(i>0)
    %>
    Your skills had been updated !!!!!
    <%
    else
    %>
    not updated
    <%
    %>
    <br>Best of Luck
    <h4><u>Back</h4>
    </body>
    </html>
    But the values are not getting stored....what to do
    thanx in advance

Maybe you are looking for

  • How can i make calculation in two file using two parameter

    how can i make calculation in two file using two parameter Solved! Go to Solution.

  • PI 7.1 EHP1 installation?

    Hi Guys, we are planning to install PI 7.1EHP1 and i was able to find all the related media on the market place with below link but i could not find the installation master.  DVD.  Generally installation master is always available but i dont see one

  • Backing Up 3rd Party Apps

    Hello, I tried searching this...maybe I didn't put in the right string of words...How does one go about backing up 3rd party apps. I have gotten that Error 523 or whatever it is...where I basically have to reinstall everything on my phone. I can usua

  • After upgrading itunes, all my music has gaps in it

    I just upgraded itunes from version 6 to 7.4.3.1. Upon startup of itunes, itunes started did something wehre it had to go through all my songs. Unfortunatly, i can't remeber what it said it was doing but it had something to do with getting informatio

  • Why decimal Places are allowed during goods issue and Goods receipt for mat

    Why decimal Places are allowed during goods issue and Goods receipt for material with unit of measure PCS. MY config allows consumption in decimal places. How to restrict this? Prem Nivas