Changing variable in JSF and passing it to bean

hi, i want to list a table content(this is ok) and i want to create command links(Delete) for all rows so that users can delete rows that they want.For this i used a datatable.To delete a row, i have String deleteCountryByIndex() method in the bean.It should take a parameter from jsp page which is index of country which is wanted to be deleted.For this, i want to use a variable which i can increment it for each row.How can i do this?
public String deleteByIndex(){
FacesContext context = FacesContext.getCurrentInstance();
String paramValue = (String)
context.getExternalContext
().getRequestParameterMap().get("paramName");
... here i can take parameter from the page, but i cannot increment it on the page.
<h:dataTable id="dataC" var="tab" value="#{backingCountry.list}">
<h:column>
<h:outputText value="#{tab.country_id}" />
</h:column>
<h:column>
<h:outputText value="#{tab.country_name}" />
</h:column>
<h:column>
<h:outputText value="#{tab.region_id}" />
</h:column>
<h:column>
<h:commandLink value="sil" type="submit"
action="#{backingCountry.deleteByIndex}">
<f:param name="paramName" value="5"/>
</h:commandLink>
</h:column>
</h:dataTable>as you see, when i give the parameter 5, it deletes the fifth country.
how can i use a variable in the value property of f:param ?
Thanks for any advice.

That's not the way how to do it.
There are in general 3 ways to solve this problem.
1) Bind the h:dataTable to an UIData property in backing bean and use HtmlDataTable#getRowData() to get the row object where the link was clicked.
2) Use f:setPropertyActionListener instead of f:param, e.g. <f:setPropertyActionListener target="#{bean.tab}" value="#{tab}" />.
3) Move the action method from the backing bean to the row object itself, e.g. #{tab.delete}.
For more pointers and hints check this article: [http://balusc.blogspot.com/2006/06/using-datatables.html].

Similar Messages

  • How can I change my icloud address and pass word ( not Apple ID)

    I am trying to sync music on my iphone and it doesn't back up while syncing and when done there is a problem with the new music and it has a small cloud next to all the tracks that aren't playing and I dont have the info for my old icloud I had created. Plzhelp

    Your personal iCloud account has nothing to do with this.  Your ability to sync music to your device is based on your computer being authorized for the ID used to purchase it.  When you sync, that authorization transfers to your device as well.  There is a limit on the number of different IDs your device can be authorized for.  I believe the number is 5.  That is, you can have media on your device that was purchase from no more than 5 different IDs.
    If that isn't the issue, try posting over in the iTunes forum.  They can probably help you figure out what the syncing issue is.
    Changing your iCloud ID and password won't help with this issue.  Also, just as an FYI, an iCloud ID is also an Apple ID, and you change it the same way you change any other Apple ID.

  • Reading Variable from JSP and pass to servlet

    hello
    i have a servlet page which transfers data to a jsp page. The jsp displays the data only. Now i want to read a string from a jsp page and then pass it to the servlet.
    How can i do it?
    thnks

    hello
    this is working fine: out.println("<input
    type=\"hidden\" name=\"bookId\" value=\"+bookId+\"
    size=\"25\">") ;
    works fine
    thnksI guess you didn't understand me. Look to the difference between the following two statements:
    out.println("<input type=\"hidden\" name=\"bookId\" value=\"+bookId+\" size=\"25\">") ;and
    out.println("<input type=\"hidden\" name=\"bookId\" value=\""+bookId+"\" size=\"25\">") ;In the first you're handling the bookId variable as String, in the second it will use the actual value of bookId.

  • HT202213 how do i add another computer to my itunes account, system says i have five athourized devices and have to deauthourize one of them or all. if i deauthorize all, and then reauthorize the current devices, will i have to change my apple id and pass

    how do i unauthorize all computers and reauthorize without fear of losing all data, personal, and account settings. Apple says I have five already as i count four and want to add another

    No problem, just "deauthorize all" and then authorize the four individually. You will lose nothing - except the ability to "deauthorize all" for another year.
    Don't change your Apple ID.

  • How to change the OS name and pass of database server.

    Hi,
    I have a problem with OEM of oracle10g is not running after changing the OS's (windowsXP and Linux 4.5 ) Name and IP-Address, What should I do? OR
    Can anyone give me the metalink document ID to resolve my problem?
    My Database Version is below:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    Thanks,
    Faziarain

    [email protected] wrote:
    But, How to re-create it?Use the following commands. 1st would drop the repository, 2nd would create it.
    emca -deconfig dbcontrol db -repos drop
    emca -config dbcontrol db -repos createPlease note that these commands must run from the terminal/command prompt and not from the sql prompt.
    HTH
    Aman....

  • TS4268 I have changed my Apple ID ,and passed word got email it was successful,but FaceTime keep telling me I have wrong id or to check my connection,can some one help

    Can someone help with my problem ,can,t sign into face time,changed my id and password ,keeps tellin me can,t sign in ,frustrated

    Try sign out and sign back in with new Apple ID
    Settings>FaceTime>Apple ID

  • How do i change apple ID and pass code on my iphone 4s

    how do i change my apple id and pass code on my phone?

    Use manage in
    https://appleid.apple.com

  • Storing carriage return and other special characters in a TestStand variable and passing to LabVIEW

    I am using TestStand step to call a LabVIEW VI that writes commands to a serial device.  The device expects a carriage return at the end of the command.  I can create a constant string in TestStand with the carriage return, e.g., "ATA\x0D" and pass that to a LabVIEW string control which shows ATA\r and the VI works properly.
    To provide consistency and flexibility in my code, I want to store the terminator character(s) in a TestStand variable.  However, when I try to use an expression to create the command string, i.e. "ATA" + "Locals.Terminator", where Locals.Terminator is set to "\x0D", my LabVIEW VI string control shows "ATA\\x0D" which doesn't work.  And when I try Locals.Terminator set to "\r", the LabVIEW string control shows "ATA\\r" which doesn't work either.
    Is there a way to store special characters in a TestStand variable and pass them to LabVIEW as special characters?  I saw in another post that if you edit the TestStand variable by pressing Cntl-Enter, it will store  the newline \n properly and it can be sent to LabVIEW - that works for me as well for \n.  But  I need to send a carriage return.
    I've attached my test sequence and the corresponding LabVIEW VI with a string control.
    Hans
    Attachments:
    Special Chars.seq ‏27 KB
    String Passing.vi ‏13 KB

    Hi Hans, 
    Thanks for your detailed explanation and examples.  In TestStand, change the String parameter's String Type to Binary String instead of ASCII.  Then it will pass the desired value.
    Cheers,
    David Goldberg
    National Instruments
    Software R&D

  • How can i get the name of a symbol and pass to a variable?

    Hello! Is posible to get the name of a symbol and pass to a variable??
    Thanks
    Sonia

    Ok. Bravo
    Please mark this as 'Answered' - it will help others on the forum -

  • How toStore the Date Variable and pass it when the program runs next time??

    HI All,
    My JDBC program basically needs two command line args. Rabge_Start_Dt and Range_End_Dt. for ex:
    2001-05-31 and 2001-06-01 . And my porgram should run every day. Next day the date range will be 2001-06-01 to some date. It means I have to store some how the range_end_dt and pass it as range_start_dt when my program runs the next day.
    Problem:
    How can I store the Data variable and pass it as an argument to my porgram when It runs next time. Every time my pogram runs It should pick the range start_dt (==range_end_dt of the previuos run) and end_dt I have to go and query some other data base and pass that value to it.
    Thanks in advance!!!!

    save the value in a file, then read it back in each day. Similar to when a process needs a PID.
    -blhqctz

  • My user name and pass word have not changed  I can't get into my gmail

    My user name and pass word have not changed  I can't get into my gmail

    Can you access the email on a computer using a web browser meaning are you sure it is not a problem on the gmail end?

  • HT5624 Sir, I have my id and pass but I can't change or edit my secret question and answer B'coz when I creat my id I didn't entered 2nd mail option that's why I forget my info about secret question . Naw I want to reset my secret question and answer,plz

    Sir, I have my id and pass but I can't change or edit my secret question and answer B'coz when I creat my id I didn't entered 2nd mail option that's why I forget my info about secret question . Naw I want to reset my secret question and answer,plz help me out

    You need to contact Apple to fix this. Pick your country here:
    http://support.apple.com/kb/HT5699?viewlocale=en_US

  • JS popup and passing URL variables or ?

    Hi ...
    The following JS script opens a new window and that window is
    a template called "viewer.cfm". The images are all going to shown
    in that template (viewer.cfm) ... eg: HPIM0877.JPG, HPIM1009.JPG
    I have to pass variables from any pages that have the
    following link (below) to "viewer.cfm".
    I will have maybe 40 images to deal with but I am getting
    stuck on a universal #variable# to display the images and passing
    them.
    I have not included any code on the receiving template
    "viewer.cfm" as I am a little stuck.
    Thanks ...
    EXAMPLE
    <cfoutput><A HREF="javascript:void(0)"
    onclick="window.open('viewer.cfm?#HPIM0877.JPG#',
    'welcome','width=580,height=440,menubar=no,status=no')">
    courses</A></cfoutput>

    On the template with the JS pop up window. (index.cfm)
    <cfset
    peaks="/motorcoach/ca/images/popup/HPIM1070.JPG">
    <cfoutput><A HREF="javascript:void(0)"
    onclick="window.open('viewer.cfm?image=#peaks#',
    'welcome','width=650,height=500,menubar=no,status=no')">
    peaks</A></cfoutput>
    On the template which will produce the image (viewer.cfm)
    <cfparam name="url.image" default="0">
    <cfoutput><IMG SRC="#url.image#" width="550"
    height="413" class="image"></cfoutput>
    Cheers

  • Question about .swf and HTML5 output and passing variables via querystring

    Hello,
    I am using Captivate 7. We're developing a program that we would like to output both for desktop users and mobile users.If I'm correct, multiscreen.html will determine whether or not to load index.html (which is for mobile users) or yourprogram.htm (for desktop users).
    Currently, we pull and push data from the database using .NET via a querystring and Javascript into yourprogram.htm. In the program, there's a Response.Redirect which sends that data (what screen you've finished reviewing as well as quiz data). So it basically reloads yourprogram.htm after each "save" point. We're wondering how to best approach it if multiscreen.html is first loaded, we imagine the variables may not get passed back and forth correctly into the index.html(HTML5 output)? Has anyone had experience with developing a program this way?
    Looking forward to your insights, recommendations and anything to look out for.
    Thanks,
    Ruth

    Basically, the code is meant to be an example of using a wrapper to modify output before it gets written to the file. So, println is called and the wrapper just alters any text that comes to it before it gets printed to the file. Think of writing to a message to an error log and appending the Date and time to the front.
    The code works fine if you only work on the string that is passed in by itself such as:
    s = s.replace('1', '2');When I try to add text onto the string s I run into problems. I need to send the length of the string to the write function but then length ends up being 8202 on the new string. I don't understand why. I am wondering if this has to do with converting chars to string or the way strings are passed to methods.
    This method is called first and then calls the write method with the string as a param.
    public void write(char[] cbuf, int off, int len) throws IOException {
                    String s= new String(cbuf);
                    this.write(s, off, len);
            }but for some reason when I try to create a new string from the string passed in or try to append text to it, the length of the string gets message up.
    Does that help?
    Sorry, I am just trying to understand what is going on here.
    Thanks.

  • How to import values from txt and pass values to variables

    I need to export some variables from Indesign and import them in Illustrator.  I can export a txt file from InDesign but I don't know how to import and pass the values to variables in Illustrator.
    Can someone help?

    Well from you ID script Im presuming that you are simply writing a few lines of info to a plain text file like so…
    writeFile('SomeData');
    writeFile('AnotherData');
    writeFile('LastData');
    function writeFile(info) {
         try     {
              var log = File('~/Desktop/ID_Data.txt');
              log.open('a');
              log.write(info + '\r');
              log.close()
         catch (e) {
              alert(e);
    So you would just read this back where or when ever you need to use it in your Illustrator script…
    var log = File('~/Desktop/ID_Data.txt');
    log.open('r');
    var a = log.readln();
    var b = log.readln();
    var c = log.readln();
    log.close();
    alert(a);

Maybe you are looking for

  • What is compatibility of Adobe Acrobat Version 7 with Windows 8 ?

    Please advise what the compatibility of Adobe Professional Version 7 is with Windows 8 ?

  • Range issue

    I am working on a piece of code: we have a custom table ZVEND_DETAILwhich has the following fields: 1. Vend_num1_From 2. Vend_Num1_To 3. Vend_num2_From 4. Vend_num2_TO 5. Zcode now the user will enter the above fields on the screen and I need to chec

  • Is It going Wobbly!

    Hi, I'm having issues with my connection the noise on the line has increased from its steady 6db to 9db; I'm connected to the only BT socket in the house through an ADSL V1.0 faceplate.  Some weeks back lost connection for most of the weekend althoug

  • Adobe Captivate won Best of ELEARNING! 2007 award!

    I cannot even believe in this piece of news, am very happy with the conquered title, it cost all the efforts dedicated to this fantastic technology. Congratulations to every team of the Adobe Captivate and the Communities that do from this technology

  • Mac Book Pro Restarts automatically

    My mac book pro hangs for few seconds and then restarts. This problem has started after I have upgraded to OS X Yosemite. Please fix this.