How to use javascript functions in struts jsp page

hi
iam using struts jsp pages. here iam calling one javascript function. but iam not able to access the form in javascript.
wat i have to give as form name to get the elements of the form.
please reply me soon
it is urgent
vamsi

your form has no name liek this one:
<html:form action="/userRegistration.do" >so you cannot access the elements inside your form?
accessing the elements inside the form will be like this:
document.forms[0].propertyName.value;

Similar Messages

  • How to return javascript function value to jsp page

    Hi i want to retrieve values from javascript function to jsp page, how can i do that ? i am trying this but its not working
    <script language="javascript" type="text/javascript" src="/feedback/common/scripts/config.js"></script>
    <script language="javascript" type="text/javascript" src="/feedback/common/scripts/richtext.js"></script>
    <td>
    <jsp:param id="description" value= "<%=request.initRTE('', '')%>"/>
    </td>
    here this initRTE function is used for displaying rich text editor .....i want to retrieve back the contetnt written in this editor and save it to DB.
    Please help.
    Edited by: xtech on Apr 4, 2008 12:00 PM

    surely i will do that but my app is still not working.....
    here is my code
    </td>
    <td align="left">
    <script language="javascript" type="text/javascript" src="/feedback/common/scripts/config.js"></script>
    <script language="javascript" type="text/javascript" src="/feedback/common/scripts/richtext.js"></script>
    <h:inputHidden id="introtext" value= "<%=request.getParameterValues(description)%>">
    <script>
    initRTE('','');
    </script>
    </td>
    in java script function i am geeting the text content
    function initRTE(rtePreloadContent, rteCSS) {
    rtePreloadContent=document.getElementById('surveyinfo:introtext').value;
    startRTE(rtePreloadContent);
    menuBuilder();
    var description= document.getElementById(rteFormName).value;
    return description;
    basically i want to get the text written in text editor in jsp and want to send it to DB.(Here initRTE() function is calling rich text editor)
    i have downloaded this editor from this url
    http://freerichtexteditor.com/page/4.htm
    and trying to embed it in my app.

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • How to use ShowValue within a UIX/JSP page to display an active link?

    I am storing URL's in the DB and want to display them as active links on a UIX/JSP page. I thought that I had this working some time ago, but now it no longer works.
    Using <bc4juix:RenderValue datasource="ds1" dataitem="myTextField" /> will display "http://www.otn.oracle.com" as an inactive link using UIX/XML which is expected.
    Using <jbo:ShowValue datasource="ds1" dataitem="myTextField" /> will display an active link using if using BC4J/JSP, which is expected.
    However, I have not been able to do this using a UIX/JSP page.
    Is it possible to use ShowValue within a UIX/JSP page to display an active link?
    Thanks,
    Bill G

    Hi Juan,
    I've done the following and it does not work for me;
    --- snip ---
    <uix:form name="form1" method="GET">
    <bc4juix:Table datasource="ds1" >
    <uix:columnHeaderStamp>
    <uix:styledText textBinding="LABEL"/>
    </uix:columnHeaderStamp>
    <%--
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <bc4juix:RenderValue datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    </jbo:AttributeIterate>
    --%>
    <bc4juix:RenderValue datasource="ds1" dataitem="FacilityDesc" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationId" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationDesc" />
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    </uix:rawText>
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:contents>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    </uix:rawText>
    </uix:contents>
    --- snip ---
    Bill G...

  • How to use VPD in Java/Struts JSP portlet with SSO

    DB = 10.1.0 (Standard Edition)
    Portal = 9.0.4.1
    10gAS = 9.4.0.1 (EE)
    I am in the beginning stages of developing some portlets that will be Java/Struts JSP based. We use SSO and have implemented some VPD security in our DB by creating some views that use SYS_CONTEXT('USERENV','CURRENT_USERID').
    These Java portlets connect to the DB using a defined JDBC connection for the OC4J container they are deployed in. The problem I'm having is that the call to SYS_CONTEXT is returning the user of the JDBC connection and not the SSO user. So far I have been unable to find any documentation that will point me in the right direction to get this configured properly.
    Deployment and configuration are as follows. Deploy war file to custom container on app server. In the configuration of the OC4J contain the app used the containers default JDBC connection using the oracle.jdbc.pool.OracleDataSource class. Max and Min open connections are blank.
    In the portal configuration under Navigator - Providers tab we defined a new Registered Provider. In the Connections tab for the provider we Specify the URL Http://hpsrv02.simsol.com:7777/discovery-portlets/providers. Under "Specify how the user's identity will be set by the Portal..." the "The user has the same identity in the Web providers application as in the Single Sign-On identity" is selected. Under "User/Session Information" User is selected and Login Frequency is set to "Once per user session". Then we created a new portal page and created a new portlet with the new provider.
    Just an FYI I do have Discoverer working with VPD and any report portlet, dynamic page portlet and any other type of portlet I created all work correctly with VPD it is just the java/struts one that is not working.
    So does any one have any insight into what configuration steps I have missed?
    Any help is much appreciated,
    Ed Klinger

    Ed,
    Your java code must get the SSO username (it's just a HTTP header variable) :
    ie: code sample...
    Enumeration e = request.getHeaderNames();
    while (e.hasMoreElements()) {
    String name = (String)e.nextElement();
    String value = request.getHeader(name);
    out.println("<br> "+name + " = " + value);
    if (name.toUpperCase().trim().equals("OSSO-USER-DN")){
    dn_user=value;
    out.println("<br>******** USER DN = "+dn_user);
    Then, the SSO username can be used in the VPD policy.
    Note that there is a difference between the sso username and the database username . SSO username is not known by database (CURRENT_USERID will return a database username)
    Discoverer worked OK in your case with the SYS_CONTEXT (.. CURRENT_USERID) because authentication is made by database user, probably.

  • How to use Javascript array in the JSP

    hELLO Friends,
    I am creating an String array using the values
    in the list of a jsp page using Java script..
    How can I use this array in the same jsp
    file for processing...
    any help in this regard would be highly appreciated.
    thanks in Advance...
    ashish

    you cannot pass values from javascript to JSP without having to form-post to another JSP page.

  • How to use jstl variable in a jsp page

    Hi all,
    I am new to JSTL and i want to access the value of jstl in jsp.
    when i use the tag like below it is displaying the value ""
    <c:out value="${ack}"/>
    But as ack is string, i want to convert it into int. and i have written like
    <c:set var="ackvalue" value="${ack}"/>
    and int ack = Integer.parseInt(ackvalue);
    But it is showing error like varialbe can not be resolved: ackvalue
    can anybody please help me regarding this?
    Waiting for your warm response.
    Thanks in advance

    Hi,
    Thanks for your immediate reply.
    I am able to display the ackvalue when i am using
    <c:set var="ackvalue" value="${ack}"/>
    and <c:out value="${ackvalue}"/>
    But my actual requirement is to use the ack value in
    switch statement. if i can assign the value to a
    String variable, then it si easy for me to proceed.
    Please help me in this regard.
    Thanks,You can use the c:choose, c:when and c:otherwise tags
    <c:choose>
        <c:when test = "${ackvalue == 1}">
               //do stuff
        </c:when>
        <c:when test = "${ackvalue == 2}">
               //do some other stuff
        </c:when>   
       <c:otherwise>
              //stuff
        </c:otherwise>
    </c:choose>ram.

  • How to use JavaScript in Web bean generated JSP

    I want to do some simple JavaScript validations (for example, checking if a particular field is empty) in the JSP page rendered by the data web bean. Because the HTML is rendered by the bean, I'm not able to refer to the HTML controls in the JSP page. I'm not even able to refer to the form with the following standard piece of JavaScript code - "document.forms[0].control_name".
    Is anybody aware of how to use JavaScript with these rendered JSP pages?

    You just have to add it like and applet , including this line in your JSP or JSF
    <script src="http://dl.javafx.com/dtfx.js"></script>Then add the applet
    <script>
        javafx(
                  archive: "./resources/jar/Draw.jar",
                  width: 400,
                  height: 200,
                  code: "Draw",
                  name: "Draw"
    </script>./resources/jar/Draw.jar - is the path and the name of the jar

  • Help me!! How to use JavaScript with JSP ??

    I am using JDeveloper and I created a screen in JSP which uses a bean for database connectivity and retriving info onto the page.
    The page has a ListBox where list items are populated from the database.My requirement is
    whenever the list is changed the page shuold be refreshed with the selected item info.
    I tried to use 'JavaScript' for triggering the event with 'onChange' event of the ListBox.But the event is not getting invoked. I think JavaScript is not working with JSP.
    Please help me with how to Use javaScript with JSP or any other alternative where I can meet my requirement.
    I have one more question...I have gone through the JSP samples in OTN and I am trying do download the sample 'Travel servlet' which show list of countries...etc
    I have also gone through the 'readme' but I don't know how to extract .jar file.
    I would be great if you could help me in this.
    Thanks!!
    Geeta
    null

    We have a similar need. We have used Cold Fusion to display data from Our Oracle Database. We have a simple SElect Box in HTML populated with the oracle data. When someone selects say the State of Pennsylvania. then we have an On change event that runs a Javascript to go get all the cities in Pennsylvania.
    Proble we are having is that inorder for the Javascript to work , we currently have to send all the valid data.
    Do you know of any way to dynamically query the the Oracle database in Javascript

  • Using Javascript Functions with Flash 8

    I wanted to know how to integrate Javascript functions with
    Flash 8 created swf files. I assume this would be done using
    ActionScript, I know some ActionScript but am not as familiar with
    it as to be able to integrate other programming languages with it.
    I'd like to be able to call other programming language functions
    with my swf files.
    The particular case I'm working on now is to be able to open
    Pop-Up windows for display of web items from within links written
    in ActionScript in a swf file. In other words, have the user click
    a link in a Flash movie and open a window using a Javascript
    window.open function that would be called. I would like the window
    to contain more flash movies that contained further links to
    functions. If any one could offer up some advice or point me to a
    few tutorials and how tos on how to get the Flash part of this done
    I'd appreciate it.
    In a broader scope, a seemless workflow linking Flash output
    files to outside scripting and programming functions would be nice
    to know if anyone has links or input on where I can read up on
    this.
    Thanks

    myButton.onRelease = function () {
    getURL("javascript:myFunc('myVars')");
    }

  • How to include custom taglib in javascript on a given jsp page

    Hi,
    How to include custom taglib in javascript on a given jsp page?
    i have a jsp page on which i am adding selectboxes using javascript.
    But now i have created my own custom select box and want to add it on a given jsp page.
    is the code to create the box box.
    <sample:pickListOptions employeeId="abcs123"/>
    but how should i embed it in javascript, so that i will be able to add it on the give jsp page.
    Thanks,
    Javaqueue

    when the jsp page is loaded for the first time it contains a select box containg names created by a taglib.but there is a feature i want to add wherein though javascript the name selectebox will keep on coming on each row i want to add. and this is row addition and deletion is being handled by the javascript. there i encounter the bug how to interact the javascript with taglib so tha with each row addition i will have populated taglib created select box on each row.
    Thanks,
    Javaqueue

  • How to use goto function?

    how to use goto function in indesign javascript??
    my script starts with chekcing whether input files are present or not.. if any of the input files r not present, i want to skip the function n terminate the functioning with displaying the message tht file doesnt exisit.... i was wondering to use goto function for tht...so how to use it? or is there any other alternative to that??

    goto is generally frowned on by programmers.
    The only legitimate use of goto is when you need to escape a nested loop.
    If you need to skip part of a routine, use break, or simply return from the current function.
    The pattern commonly used by the SDK looks like this:
    do
         if(condition1 == false)
              break;
         if(condition2 == false)
              break;
         if(condition3 == false)
              break;
         doSomethingReallyCool();
    }while(false);
    "break" jumps to the end of the do/while loop which always exits when you reach the end of it (while(false))
    Harbs

  • How to use nested tag in Struts

    Hi..
    Can any one guide me how to use nested tag in Struts. So far i already tried bean tag with no error but when i try to use nested tag i got error like
    javax.servlet.ServletException: Cannot find bean: "" in any scope
    Below are my class:
    action class
    session.setAttribute ("MyDetailList", detailList);
    JSP page
    <logic:iterate id="list" name="MyDetailList">
    Company ID : <bean:write name="list" property="companyID" />
    </logic:iterate>
    For bean tag, i got no error at all and below are my code for nested tag
    action class
    session.setAttribute ("MyDetailList", detailList);
    JSP Page
    <nested:nest property="MyDetailList">
    Make : <nested:text property="make"/>
    Car ID : <nested:text property="carID"/>
    </nested:nest>
    When i run the code, i got error message
    javax.servlet.ServletException: Cannot find bean: "" in any scope
    Any body can help me?
    zul

    what am I doing wrong?You will notice above that I mentioned
    YOU CAN'T USE CUSTOM TAGS AS ATTRIBUTES TO OTHER CUSTOM TAGS
    (was that loud enough for you to notice this time)?
    Try
    <html:text styleId="instruction" styleClass="text" size="50" name="instruction" property="value"/>
    //or
    <html:text styleId="instruction" styleClass="text" size="50" property="instruction" value="<%= instruction.getValue() %>"/>
    better alternative: populate your formbean with your action and just have:
    <html:text styleId="instruction" styleClass="text" size="50" property="instruction"/>
    If you set the "instruction" property of your formBean in the action, the value will be automagically reflected here.
    Cheers,
    evnafets

  • Call javascript function in an html page, how to?

    How can i call a javascript function in an html page were my flash catalyst swf is?

    I think you will need to import the catalyst fxp into flash or flash builder and add action script to invoke the javascript.
    These two links may be of use
    http://blog.codefidelity.com/?p=15
    http://www.switchonthecode.com/tutorials/flex-javascript-tutorial-simple-interaction
    I hope that helps

  • How to invoke  javascript function after business action??

    How to call javascript function(such as "window.close(), window.open(...),...") in the action method(public String doBusiness(){...}) of <h:commandButton>?If not,then,is there any alternate approach to call javascript function when the bussiness action method finished??
    Thanks a lot!

    Since your business method is called after the form is submitted, and your code is running on the server, probably the only thing you can do is this:
    Create a custom component (Maybe call it the "onLoad" component) that you always render at the top of your JSP. In the regular situation it wouldn't render anything, but in the case you mention, after your busines method, you would call a method on this new component on the server that would cause it to actually render something the next time it is rendered. When rendered this time, it could then render the "onLoad" method which has your window.close() code in it. The window would then close right away.
    The key is that you are not doing any of this on the client. The form is submitted, your business logic is executed, then the next page is rendered. When the next page is rendered, your javascript could be rendered to close the window.
    If I'm offbase here, someone please say something, I'd hate to send this guy on a wild goose chase.
    Dave

Maybe you are looking for

  • Customer deletion

    HI I would like to know how to manage deletion of customer or material. I would like to report only on active customer/material. i saw that in the extraction flow there is a field deletion but i made a test with a customer in R/3 i delete it with tra

  • How to delete streamed songs in iPhone?

    I listen to songs via streaming from iCloud. When flying I want to listen to records I choose to have with me. When i turn of "show all music" in Music preferences to find my manually loaded records, following happens: There are so many songs left fr

  • Time stamp and barcode into .xls spreadsheet

    Hello, I am pretty new to programming in Labview and I have a few issues I need to get worked out. I am using a "Prompt User for Input" asking for a units barcode if there is a failure. So when the message prompts I have the user scan in a barcode an

  • Date Format By Country

    Hi There Helpful people... Usual stuff first DW8, (Mac - not that that makes a difference), ASP VB connected to SQL database. I have a content management - which is used to maintain the content of an international site. On the site we have a timeline

  • How to sum time values sorted by month/year?

    I would like to sum time values that are sorted by month/year. (Concept is based on a pilot's logbook) In Table 1, Column A is a date; Column B is the associated time value (duration). In Table 2, I would like to Sum the time value of Table 1 Column