Passing javascript variable to java bean

Hi all,
Is there any way to pass a java script variable to a java bean. i'm trying hard but in vain. please suggest a way how to do it...

The variable u want to pass declare that in a dataobject class i.e consisting of getter and setters ...... when you will use the jsp:useBean tab and the setProperty tag along with the class name it will set the value of the variables ...... use form method = get to set the variables.

Similar Messages

  • How to pass javascript variable to jsp function

    i want to check which table header (that is <th> in html )is clicked and based on that a jsp funtion do a query in database and should show records in sorted way according to which column head is clicked.
    Table is created in html.
    My function is
    Vector varray = workcaseid.getWorkcaseId(Long.parseLong(MasterAccountNumber),SelectedColumn);
    <table border="1">
              <th ><label onClick="<%SelectedColumn="workcase_id";%>">Workcase Id</label></th>
              <th><label onClick="<%SelectedColumn="status_id";%>">Status</label></th>
    <tr><td>etc</td></tr>
    </table>

    im using bean for business login, following mvc model,and i think mvc is one of good design practice to use.
    <jsp:useBean id="workcaseid" scope="session"class="beanFiles.SearchWorkcaseId" />
    varray = workcaseid.getWorkcaseId(Long.parseLong(MasterAccountNumber),SelectedColumn);
    just tell me whether it is possible to pass javascript variable to jsp variable or not.i can do it by using hidden input type,using form and submit button.

  • How tp pass javascript variables/arrays to a servlet?

    Plz help me in passing javascript variables/arrays to a servlet

    Hi,
    I am creating table rows & columns containg text fields dynamically as follows:
    function addRowToTable()
    var tbl = document.getElementById('tblSample');
    var lastRow = tbl.rows.length;
    // if there's no header row in the table, then iteration = lastRow + 1
    var iteration = lastRow;
    var row = tbl.insertRow(lastRow);
    // right cell
    var cellRight = row.insertCell(0);
    var el = document.createElement('input');
    el.type = 'text';
    el.name = 'txtRow' + iteration;
    el.id = 'txtRow' + iteration;
    el.size = 20;
    cellRight.appendChild(el);
    Now i am calling function addRowToTable() from jsp page as + key is pressed to add rows dynamically.
    So as per rows different textfields are also getting created dynamically with different id & name.
    Now i am getting session attributes containing the values for textfields from servlet.
    but i am not able to map the values for dynamic textfields getting created?
    I want to print values in appropriate fields.
    Plz help me.

  • How to store jython variable to java bean shell variable

    Hello experts.
    I have one procedure. here is the details
    1st step is with java bean shell techonolgy and one variable.
    <@
    String testv=" ";
    @>
    Second step is jython technology.
    str3='storing some value as per my logic'
    <@testv@>=str3 // here I am getting error because i want to store jython variable to java bean shell variable
    Once it will be stored , I will use in query as SELECT '<@=testv@>' from dual. If this is not possible is there any way to get the jython variable in side refreshing query
    how to achieve this please suggest.
    Thank you.

    Hello experts. Any suggestion on this. How to store jython variable value into java bean shell variable.
    Thank You.

  • Need a fast answer... passing javascript variable to jsp page (how to use)

    This test application has 3 frames.
    I'm assigning a value "stuff" to a variable ("testfield1") in a javascript function ("getTest") that exists inside an html frame (testpage1.html)
    Then, I click on the "test submit" hypertext link to pass the value of "testfield1" to the JSP frame (testpage2.jsp) by invoking a function ("getData") in "testpage2".
    In function ("getData"), I am passing the variable "testfield1" as a parameter to the "getData" function in "testpage2".
    In "testpage2" - in the ("getData" function) I try to assign the value of the variable "testfield1" to another variable called "testfld1".
    Then, I try to extract the value of "testfld1" into a variable called "tstfld1" in a JSP scriptlet
    ....I.E. [ String tstfld1  = request.getParameter("testfld1");  ]
    But, the value is apparently not passed successfully, as tstfield1 appears to be "null".
    Can anyone explain what I'm doing incorrectly?
    The code for this test app is below...
    ********testpage0 - the parent frame*********
    <HTML>
    <HEAD>
    <TITLE>GlobalView Reports and Trending Menubar</TITLE>
    </HEAD>
    <FRAMESET FRAMEBORDER="0" ROWS="15%,85%">
    <FRAME SRC="testpage0.html" NAME="testhtmlparent">
    <FRAMESET FRAMEBORDER="0" COLS="23%,77%">
    <FRAME SRC="testpage1.html" NAME="testhtml">
    <FRAME SRC="testpage2.jsp" NAME="testjsp">
    </FRAMESET>
    </FRAMESET>
    </HTML>
    *******testpage1.html********
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <html>
         <head><title>testpage1</title>
         <link rel="stylesheet" type="text/css" href="./standard.css">
              <script LANGUAGE="JavaScript">
              parent.frames[2].location = "blank.html";
              function getTest(reportType)
                   testfield1 = "stuff";
                   alert("testpage1.html...testfield1=" + testfield1 + ", reportType=" + reportType);
                   parent.frames[2].location = "testpage2.jsp";
                   parent.frames[2].getData(testfield1);
                   return;
              </script>
         </head>
         <body bgcolor="#FFFFFF" text="#000000">
              <form name="reportRange">
                   <center>
                        <fieldset style="padding: 0.5em" name="customer_box">
                        <table cellpadding="0" cellspacing="0" border="0">
                             <tr class="drophead">
                                  <td valign="top" height="0" ><span class="drophead">
                                       test submit
                                  </td>
                             </tr>
                        </table>
                        </fieldset>
                   </center>
              </form>
         </body>
    </html>
    *******testpage2.jsp*********
    <%@ page language="java" import="java.io.*, java.util.*" errorPage="error.jsp" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <html>
         <head>
         <title>testpage2</title>
         <script language="JavaScript">
              function getData(testfield1)
                   alert("testpage2.jsp...testfield1=" + testfield1);
                   document.pageData.testfld1.value = testfield1;
                   document.pageData.submit();
         </script>
         </head>
         <body>
              <%
                   String error;
              %>
              <div id="HiddenForm">
                   <form name="pageData" method="post" action="testpage2.jsp" target="_self">
                   <input type="hidden" name="testfld1" value="0">
              </form>
              </div>
              <%
                   String tstfld1 = request.getParameter("testfld1");
              %>
              <P> testfld1 = <%= tstfld1 %> </P>
         </body>
    </html>

    parent.frames[2].getData(testfield1); is in testpage1.html
    so in the document.pageData.testfld1.value = testfield1; document = testpage1.html( not testpage2.html)
    modifying the getData to accept the document object, and refering this object to parent.frames[2].document may help you.
    good Luck ....

  • How to access a javascript variable from Java?

    Here is my code:
    function validateLoginForm() {
        var username = document.getElementById('un');
        setCookie('un', username, 3650);
        //etc.
    <%   
        HttpSession httpSession = request.getSession();
        httpSession.setMaxInactiveInterval(30 * 60); //30 minutes
        httpSession.setAttribute("un", username); //!prob here - cannot resolve 'username'
    %>
    }...but how do I access the javascript variable 'username' from the Java code?
    Thanks,
    James

    The only way to pass values between JavaScript and JSP is through cookies. It sucks, I know, but right now that is the only option.
    You already are creating a cookie in JavaScript. So go ahead and read it in Java:
    Cookie[] cookies = request.getCookies();
    for(int i = 0; i < cookies.length; i++) {
        Cookie c = cookies;
    if (c.getName().equals("un")) {
    // Do what you need here.

  • How to pass javascript variable to PLSQL stored procedure

    Hi,
    How can I pass a javascript variable to a database procedure. I have a form with a radio button group and would like to save the value of the selected radio button to a database table by passing the value to the stored procedure.
    Thanks

    Hi
    You can use iframe to call the procedure. Here is an example used in dynamic page or pl/sql portlet. The pl/sql procedure is called myprocedure and resists in the schema myschema. This example passes 2 parameters, but I have not yet reased a limit.
    First the call within a javascript function:
    myiframe.location.href="myschema.myprocedure?p_myprameter1=" + vJvascriptparameter1 + "&p_myprameter2=" + vJvascriptparameter2;
    Then the iframe:
    <iframe id="myiframe" height="0" width="0" frameborder="0"></iframe>
    You can let the pl/sql procedure print a value, that can be used i the portlet. You can get the value in a javascript this way:
    myvalue=top.window.frames["myiframe"].document.body.innerHTML;
    Best regards
    Klaus

  • Assigning javascript variables to java variables in JSP

    Does anyone know if it possible to assign a javascript value to a java variable in a javascript function? I want to be able to use the javascript value in a PreparedStatement call, but I can't assign the value of the javascript variable to a java variable. I know the opposite can be done using hidden variables in the form, but I need:
    javascript -> java variable in a JSP scriptlet.
    Any help would be much appreciated,
    Thanks,
    -Dave

    Can't do that.
    html/javascript is in the client side.
    jsp is in the server side.
    In order to put html/javascript values (client side) into jsp (server side) it must be submitted.
    Try remoting. Using an iframe with a jsp as the source of it and the html target pointing at it.
    -------------

  • Assigning javascript variable to java variable??

    I'm working on a web app, and part of it is form to add/update customers information. What my problem is I have all the cities of the US and Canada in a database and was using javascript to load the cities depending on which province/state is selected from another list box. Because the database is so large it takes a long time and everytime the page loads it takes a long time because the java code runs. The cities are loaded into the page by a javabean which returns a vector with all of the cities. What I want to do is use the province or state id to pass to the bean and just retreive the cites for that state as oppose to loading all of them. However, I'm stuck with assigning that value from my list box, which I would use javascript to determine, then passing it as a parameter to the bean.
    From the research I did, it seems like it can't be done. I'm seeking some advice thoough, as there would be someone who had this problem before and solved it or found a work around. Would be grateful for any help and advice. below is a part of my code that's presenting the obstacle.
    <script type="text/javascript">
    <!--
    function fillCityList()
         var num=document.mDetails.provinceId.options[document.mDetails.provinceId.selectedIndex].value
         var boxlength=0
         document.mDetails.cityId.options.length = 0     
         <%     
         for ( int ctr=0;ctr<cityList.size();ctr++)
              City aCity = (City) cityList.elementAt(ctr); %>     
              if(num==<%= aCity.getProvinceId() %>)
                        document.mDetails.cityId.options[document.mDetails.cityId.options.length]=new Option("<%= aCity.getCityName() %>", "<%= aCity.getCityId() %>");     
         <% } %>           
    // -->
    </script>
    </html>

    How about doing this:
    <html>
    <head>
    <script language="JavaScript">
    vfnStateChange = function() {
         var oState = document.forms['myform'].state;
         var sState = oState.options[oState.selectedIndex].value;
         document.location.href='thispage.jsp?state=' + sState;
    </script>
    </head>
    <body>
    <form name="myform" action="somepage.jsp">
    <select name="state" onchange="vfnStateChange();">
    <%
    ArrayList stateList = somebean.getStates();
    for(int i = 0; i < stateList.size(); ctr++) {
         State s = (State)stateList.elementAt(i);
    %>
    <option value="<%= s.getStateId() %>"><%= s.getStateName() %></option>
    <% } %>
    </select>
    <select name="city">
    <%
    String state = request.getParameter("state");
    if(state == null) {
    %>
    <option value=""></option>
    <%
    } else {
         ArrayList cityList = somebean.getCities(state);
         for(int i = 0; i < cityList.size(); i++) {
              City c = (City)cityList.elementAt(i);
    %>
    <option value="<%= c.getCityId() %>" <%= c.getStateId().equals(state) ? "" : "selected=\"selected\"" %>><%= c.getCityName() %></option>
    <%
    %>
    </select>
    </form>
    </body>
    </html>

  • Pass javascript array to java

    hii
    I have to pass a javascript array to my java MyAction.do . So how can i do it???
    Thnking You

    Being a Java newbie, I can't give you a definitive on how to pass the array to a client-side applet, although it should be possible.
    As for passing it to something server-side there are only a couple ways: in a GET request on the query string or in a POST. No matter what, you will have to flatten the array with some method or other, to convert it into a text string that can be parsed on the other end.
    I personally favor using hidden form elements and posting the data, because otherwise you have to worry about urlencoding your query string. You could just use javascript itself to write a series of hidden text inputs and then submit the form, so all your form handler has to do is pick up the variables.
    Let's say the array is named "myarray":
    Code:
    +<script language="Javascript">+
    document.writeln("<form name=\"myform\" method=\"POST\" action=\"myserver/myhandler.jsp\">")
    for(i = 0; i < myarray.length; i+){+
    document.writeln("<input type=\"hidden\" name=\"myarray[" i + "]\" value=\"" + myarray[i] + "\">")+
    +}+
    +document.writeln("</form>")+
    +document.myform.submit()+
    +</script>+
    I know this is clunky and "low-tech" but it will work, and has the benefit of working for any server-side platform that can handle forms

  • How to pass javascript variables into an Edge Animate project from HTML

    I have just about got the basics nailed for Edge Animate now - coming from a Flash background it's been fairly straight forward, nice work so far (but more on that later)
    I have had to build a "promoted items" slider for the homepage on one of our sites....previously this would have been a flash animation but, hey ho .
    I originally built it as a jQuery extension/plugin but found it too time consuming to make minor alterations - that's where Edge came in and SEEMED to fill the job pretty well.
    Now for the moment i'll put on hold the whole issue about how we NEED to be able to work with dom-level elements directly on the page (eg, animating divs and images within a ul-li structure which is how these things usually work) and concentrate on the Edge specific issue...
    I've seen a few people asking this same question, but none of the answers either a) work at all for me , or b) are good enough for what I need to do.
    see previous solutions here http://support.muse.adobe.com/message/4658175 and here : http://forums.adobe.com/thread/1065343
    My project uses an internal array of data, and while in "preview" mode it works reasonably well.
    in the Stage creationComplete event i have Edge code like, for example :
       var imagesArray = ["images/img1.jpg", "images/img2.jpg", "images/img3.jpg"];
       var headlinesArray = ["product 1", "product 2", "product 3"];
       var subTxtArray = ["lovely widgets", "smelly doo-dads", "purple whatchamacallits"];
       var linksArray = ["http://www.adobe.com", "http://www.adobe.co.uk", "http://www.adobe.net"];
       //variables set to full internal scope, used immediately after this and called from sub-elements afterwards
       sym.getComposition().getStage().setVariable("imagesArrayData", imagesArray);
    this code obviously needs to be changed via the HTML page that is calling it.
    IDEALLY i would have these elements already on the page ( <div><h1>Product 1</h1><img src="....  etc ) and then jquery it to hell to make it look funky. This is how we NEED to be doing it in the future...that way our content is still searchable and findable by search bots etc. Edge will output a "static" version of the page, i tried that, but it won't work for dynamically built objects. There's no way i've found of building an array of Symbols based on the existing DOM structure like you can do in jQuery itself.
    however, in the meantime i'll settle for being able to set a javascript call up somewhere - like the old flashvars solution (which was horrible fudge, but worked as a way to get data into a project )
    i'd REALLY rather not use an internal jSon call .... it's adding uneccessary bandwidth and additional server processing when the data it needs has already been retrieved from the database when the HTML page is drawn - AND it means i need to make sure that the json producing web service gets ported accross to any other projects that use this same "slider"
    i've tried removing the internal declaration and changing my HTML to :
    <script>
    var imagesArray = ["images/img1.jpg", "images/img2.jpg", "images/img3.jpg"];
       var headlinesArray = ["product 1", "product 2", "product 3"];
       var subTxtArray = ["lovely widgets", "smelly doo-dads", "purple whatchamacallits"];
       var linksArray = ["http://www.adobe.com", "http://www.adobe.co.uk", "http://www.adobe.net"];
    </script>
    <!--Adobe Edge Runtime-->
         <script type="text/javascript" charset="utf-8" src="index_edgePreload.js"></script>
    etc
    but this hasn't worked.
    i'm going to attempt the solution using
    AdobeEdge.bootstrapCallback(function(compId) { ....
    as found on http://forums.adobe.com/thread/1065343
    but this doesnt explain how to set up Stage level variables, rather than targeting a specific Edge property
    Anyone got any ideas? Or do I just scrap the project?
    IMHO : Adobe need to be careful of falling into the same mindset that most of the anti-flash brigade have.
    Please remember that Flash is used for WAY more than just adverts.
    At the moment, Edge will work great as a way to put a simple animation onto the page with REALLY basic interactivity - suitable for a basic advert - but we need our HTML5 animations and scripts to be fully dynamic, data-driven, and portable, and preferably using existing DOM elements.
    One last thing, any chance of a feature to say "my page already uses jQuery, don't import Edge's own outdated version"
    Message was edited by: j1mp

    I have just about got the basics nailed for Edge Animate now - coming from a Flash background it's been fairly straight forward, nice work so far (but more on that later)
    I have had to build a "promoted items" slider for the homepage on one of our sites....previously this would have been a flash animation but, hey ho .
    I originally built it as a jQuery extension/plugin but found it too time consuming to make minor alterations - that's where Edge came in and SEEMED to fill the job pretty well.
    Now for the moment i'll put on hold the whole issue about how we NEED to be able to work with dom-level elements directly on the page (eg, animating divs and images within a ul-li structure which is how these things usually work) and concentrate on the Edge specific issue...
    I've seen a few people asking this same question, but none of the answers either a) work at all for me , or b) are good enough for what I need to do.
    see previous solutions here http://support.muse.adobe.com/message/4658175 and here : http://forums.adobe.com/thread/1065343
    My project uses an internal array of data, and while in "preview" mode it works reasonably well.
    in the Stage creationComplete event i have Edge code like, for example :
       var imagesArray = ["images/img1.jpg", "images/img2.jpg", "images/img3.jpg"];
       var headlinesArray = ["product 1", "product 2", "product 3"];
       var subTxtArray = ["lovely widgets", "smelly doo-dads", "purple whatchamacallits"];
       var linksArray = ["http://www.adobe.com", "http://www.adobe.co.uk", "http://www.adobe.net"];
       //variables set to full internal scope, used immediately after this and called from sub-elements afterwards
       sym.getComposition().getStage().setVariable("imagesArrayData", imagesArray);
    this code obviously needs to be changed via the HTML page that is calling it.
    IDEALLY i would have these elements already on the page ( <div><h1>Product 1</h1><img src="....  etc ) and then jquery it to hell to make it look funky. This is how we NEED to be doing it in the future...that way our content is still searchable and findable by search bots etc. Edge will output a "static" version of the page, i tried that, but it won't work for dynamically built objects. There's no way i've found of building an array of Symbols based on the existing DOM structure like you can do in jQuery itself.
    however, in the meantime i'll settle for being able to set a javascript call up somewhere - like the old flashvars solution (which was horrible fudge, but worked as a way to get data into a project )
    i'd REALLY rather not use an internal jSon call .... it's adding uneccessary bandwidth and additional server processing when the data it needs has already been retrieved from the database when the HTML page is drawn - AND it means i need to make sure that the json producing web service gets ported accross to any other projects that use this same "slider"
    i've tried removing the internal declaration and changing my HTML to :
    <script>
    var imagesArray = ["images/img1.jpg", "images/img2.jpg", "images/img3.jpg"];
       var headlinesArray = ["product 1", "product 2", "product 3"];
       var subTxtArray = ["lovely widgets", "smelly doo-dads", "purple whatchamacallits"];
       var linksArray = ["http://www.adobe.com", "http://www.adobe.co.uk", "http://www.adobe.net"];
    </script>
    <!--Adobe Edge Runtime-->
         <script type="text/javascript" charset="utf-8" src="index_edgePreload.js"></script>
    etc
    but this hasn't worked.
    i'm going to attempt the solution using
    AdobeEdge.bootstrapCallback(function(compId) { ....
    as found on http://forums.adobe.com/thread/1065343
    but this doesnt explain how to set up Stage level variables, rather than targeting a specific Edge property
    Anyone got any ideas? Or do I just scrap the project?
    IMHO : Adobe need to be careful of falling into the same mindset that most of the anti-flash brigade have.
    Please remember that Flash is used for WAY more than just adverts.
    At the moment, Edge will work great as a way to put a simple animation onto the page with REALLY basic interactivity - suitable for a basic advert - but we need our HTML5 animations and scripts to be fully dynamic, data-driven, and portable, and preferably using existing DOM elements.
    One last thing, any chance of a feature to say "my page already uses jQuery, don't import Edge's own outdated version"
    Message was edited by: j1mp

  • Passing JavaScript Var ---- to java method....URGENT...PLEASE ...HELP

    I am doing a simple java Servlet example...
    I have value that is assigned in a one of the javascript function().
    Below i have the function where i get the columnValue....
    i want to use that value in the doPost method in my Servlet1 class...
    Can someone please tell me how i can do this...
    function getGridValue(oColumn) {
         var oRow;
         var oCell;
         var lIdx;
         var columnValue;
         try {
              lArrayLength = GridArrays.length;
              if (lArrayLength < 1) {
                   return false;
              for (lLoop=0; lLoop<lArrayLength; lLoop++) {
                   oRow = GridArrays[lLoop];
                   oCell = oRow[0];
                   columnValue = oRow[oColumn];
                   if (oCell.SortVal == 1) {
                        alert(columnValue.SortVal);
                        break;
                        return true;     
         catch(exception){
              if(exception.description == null){
                   alert("GridSerVal: " + exception.message);
              else{
                   alert("GridSetVal: " + exception.description);
    Servlet1 class
    public void doPost(HttpServletRequest request, HttpServletResponse res)
    throws IOException, ServletException
    String xParameterName = null;
    String xParameterValue = null;
    PrintWriter out = res.getWriter();
    PolicyInformation policyInformation = null;
    Enumeration e = request.getParameterNames();
    while (e.hasMoreElements()) {
    xParameterName = (String) e.nextElement();
    xParameterValue = request.getParameter(xParameterName);
    if ((xParameterValue.trim().length() !=0 )){
    if(xParameterName.compareTo("firstnameTextfield")==0){
    else if(xParameterName.compareTo("lastnameTextfield")==0){
    else if(xParameterName.compareTo("policynumberTextfield")==0){
    StringBuffer outstring = new StringBuffer();
    outstring.append(createScript.policyReCreateSearchForm(xParameterValue));
    outstring.append(createScript.setTopPart());
    outstring.append(createScript.getHeader());
    Vector policyInformationVector1 = getPolicyInformation(res, xParameterValue);
    Iterator iter = policyInformationVector1.iterator();
    PolicyInformation aPolicyInformation = null;
    while(iter.hasNext()){
    Object[] data = new String[policyInformationVector1.size()];
    for (int ii=0; ii < data.length; ii++){
    int rowNum = ii + 1;
    aPolicyInformation = (PolicyInformation) iter.next();
    f = aPolicyInformation.getFirstName();
    l = aPolicyInformation.getLastName();
    d = aPolicyInformation.getDOB();
    s = aPolicyInformation.getSSN();
    p = aPolicyInformation.getPolicyNumber();
    m = aPolicyInformation.getMiddleName();
    pid = aPolicyInformation.getPid();
    outstring.append(createScript.setRowValue(f,m,l,p,pid,d,s,rowNum));
    outstring.append(createScript.setRowValue1());
    outstring.append(createScript.getBottom());
    out.println(outstring.toString());
    else if(xParameterName.compareTo("ssnTextfield")==0){
    THis is where i want to get the value from the javascript and use that value to run a query...
    // checks if the ViewSubmitButton is submitted....
    if(xParameterName.compareTo("viewSubmitButton") == 0){
    } // end of while(e.hasMoreElements())

    I'm not quite sure what your problem is specifically, but at first glance I can tell you that you can't access the response object until you are done with your request object. Make sure you do everything you want to do with the request object and then when you are done make your call to res.getWriter() and send your output.

  • Pass parameter to a java bean

    am new to jsp.
    Nevertheless i have a table in a jspf with characters A-Z which are command links.
    Here is the code
    <%-- any content can be specified here e.g.: --%>
    <body>
    <table width="600" border="0">
        <TR>
           <%
            for(char i='A';i<='Z';i++)
                out.println("<TD><a href=\"x\">"+i+"</a></TD>");
             %>
        </TR>
    </table>
    </body>once i click on any of those letters, it should open a jsf href="x"
    the backing bean should for the jsf should know the character i clicked
    since i will use it in a query. the problem is how to ppass it from a command
    link. for inputText, i have no problem.
    assume i have this backing bean with the string searchStr to hold the value of the character i clicked, what should i add.
    public class OfficerController1 {
        /** Creates a new instance of OfficerController */
        public OfficerController1() {
        private String searchStr;
        public DataModel getOfficers() {
            EntityManager em = getEntityManager();
            try{
                Query q = em.createQuery("select object(o) from Officer as o where o.fullName like '"+searchStr+"%'");
                q.setMaxResults(batchSize);
                q.setFirstResult(firstItem);
                model = new ListDataModel(q.getResultList());
                return model;
            } finally {
                em.close();
    }

    am glad this is my 100th post. means i have a passion for java. i envy guys
    i see with 30000 post. seems they have been posting since their 10th birthday
    <body>
    <table width="600" border="0">
        <TR>
           <%
            for(char i='A';i<='Z';i++)
                out.println("<TD><h:commandLink  action=\"#{officer.searchOfficer2}\"value="+i+">"+
                             "<f:param name=\"firstLetter\" value=\""+i+" \"/>"+
                              "</h:commandLink></TD>");
                             %>
        </TR>
    </table>
    </body>this is transcation officer.searchOfficer2
    public String searchOfficer2() {
            return "officer_search2";
        }from the faces config.xml
    i have this
    <navigation-rule>
        <navigation-case>
          <from-outcome>officer_search2</from-outcome>
          <to-view-id>/users/officer/officer/List2.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>this new jsp has a backing bean which ought to get the parameter from
    the command link.
    i have this
    public class OfficerController1 {
        /** Creates a new instance of OfficerController */
        public OfficerController1() {
    private String firstLetter;
    public String getFirstLetter() {
            return firstLetter;
        public void setFirstLetter(String firstLetter) {
            this.firstLetter = firstLetter;
    public DataModel getOfficers2() {
            EntityManager em = getEntityManager();
            try{
                Query q = em.createQuery("select object(o) from Officer as o where o.fullName like '"+firstLetter+"%'");
                q.setMaxResults(batchSize);
                q.setFirstResult(firstItem);
                model = new ListDataModel(q.getResultList());
                return model;
            } finally {
                em.close();
        }}in the config.xml i added this
    <managed-bean>
        <managed-bean-name>officer3</managed-bean-name>
        <managed-bean-class>users.entities.OfficerController1</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
           <property-name>firstLetter</property-name>
           <value>#{param.firstLetter}</value>>
        </managed-property>>
      </managed-bean>error message
    Element 'managed-property' cannot have character [children], because the type's content type is element-only

  • How to pass  JavaScript variable value throuh netui form ??

    Hi All,
    I have reqmnt,where in I need to pass the value from JavaScript function through
    Form submission.
    I could able to pass this through simple HTML form using SIMPLE HTML tags. How
    can i do the same thing using NETUI tag (NETUI form)??
    Can somebody throw some input on this??
    TIA,
    RAM.

    Excellent - Thats what I was also looking.
    RAM.
    Thomas Cook <[email protected]> wrote:
    >
    Here's an example of what I think you're trying to do:
    <netui:html>
    <body>
    <netui:form action="submitIt" tagId="myForm">
    <netui:button value="Submit It" onClick="return setFormValue()"/>
    <script>
    function setFormValue()
    var form = document.getElementById( getNetuiTagName( "myForm",
    this ) );
    var newVal = document.createElement( "input" );
    newVal.type = "hidden";
    newVal.name = "foo";
    newVal.value = "bar";
    form.appendChild( newVal );
    return true;
    </script>
    </netui:form>
    </body>
    </netui:html>
    Thomas
    RAMt wrote:
    Hi All,
    I have reqmnt,where in I need to pass the value from JavaScript functionthrough
    Form submission.
    I could able to pass this through simple HTML form using SIMPLE HTMLtags. How
    can i do the same thing using NETUI tag (NETUI form)??
    Can somebody throw some input on this??
    TIA,
    RAM.
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
    <title></title>
    </head>
    <body>
    Here's an example of what I think you're trying to do:<br>
    <br>
    <tt><nobr><netui:html></nobr><br>
    <nobr>  <body></nobr><br>
    <nobr>    <netui:form action="submitIt" tagId="myForm"></nobr><br>
    <nobr>    <netui:button value="Submit It" onClick="return
    setFormValue()"/></nobr><br>
    <nobr>    <script></nobr><br>
    <nobr>      function setFormValue()</nobr><br>
    <nobr>      {</nobr><br>
    <nobr>          var form
    = document.getElementById( getNetuiTagName(
    "myForm", this ) );</nobr><br>
    <nobr>          var newVal
    = document.createElement( "input" );</nobr><br>
    <nobr>          newVal.type
    = "hidden";</nobr><br>
    <nobr>          newVal.name
    = "foo";</nobr><br>
    <nobr>          newVal.value
    = "bar";</nobr><br>
    <nobr>          form.appendChild(
    newVal );</nobr><br>
    <nobr>          return true;</nobr><br>
    <nobr>      }</nobr><br>
    <nobr>    </script></nobr><br>
    <nobr>    </netui:form></nobr><br>
    <nobr>  </body></nobr><br>
    <nobr></netui:html></nobr></tt><br>
    <br>
    Thomas<br>
    <br>
    RAMt wrote:
    <blockquote cite="[email protected]" type="cite">
    <pre wrap="">Hi All,
    I have reqmnt,where in I need to pass the value from JavaScript function
    through
    Form submission.
    I could able to pass this through simple HTML form using SIMPLE HTML
    tags. How
    can i do the same thing using NETUI tag (NETUI form)??
    Can somebody throw some input on this??
    TIA,
    RAM.
    </pre>
    </blockquote>
    </body>
    </html>

  • How to pass a javascript variable to a javabean method

    Hi
    I need to pass a String from a Javascript argument to a javabean method. localUrl will be instantiated with a string not from any form item(option box, textbox, etc) so cannot use
    String param = request.getParameter("XXX").
    My code below does not work as localUrl is not seen by javaBean and returns a null.
    function ShowWaitDisplay(localUrl)
    var Description = <%=RandomFeeds.getDescription(localUrl)%>;
    //Do something with the string Description
    Thanks
    Andrew

    Since, java bean code will be executed on the server side and java script executes on client side, by the time your javascript variable created, the bean code is already been executed.

Maybe you are looking for

  • How to design a loop process in BPEL

    Dear all: Thanks in advance for your any suggestion. Scenario I try to implement a BPEL which runs some activities periodically until meets some condition. Problem 1. How should I goto the start activity of the loop when the process finishes one cycl

  • Append data to the End of an Excel file

    How can I add new data (of a new aquisition) to an existing excel file without erasing old data? I'd like to add the new data aquisition under the last data aquisition. I have not the excel toolkit. I add here two file, the block diagram (i'm new in

  • Passing SELECT-OPTIONS value to Function Module

    Hi, I need to pass select-options value to a function module. Code is like the following: SELECT-OPTIONS seltab FOR object-type. CALL FUNCTION 'Z_MY_FM'       EXPORTING         sel_tab         = seltab      IMPORTING         result_tab     = it_resul

  • HT4235 unknown error 0xE8000084

    how can i fix this fault (0xE8000084)

  • CIMC in-band Management, V2.2.1b

    < V2.2.1b, there was a limitation, that FI out of band and VIP PLUS KVM IP addresses had to be in the same IP subnet, Vlan. I assume, that now with in-band KVM management (2.2.1b), this limitation no more exists. can someone please confirm ?