Eliminate Scriptlets in form radio

I have a web form working great for the past year using Scriptlets and Bean in Tomcat 6.0.20.
Now I would like to eliminate the Scriptlets and use EL instead.
Please advise how I can get the below radio input to work with EL in my JSP. All my attempts are not working.
Bean that worked with the Scriptlet:
public String getCityRadio(String myField)
      String myRadio = "";
      if(getCity() != null)
           if(getCity().equals(myField))
                 myRadio = "checked";
      return myRadio;
}JSP works with Bean and Scriptlets:<jsp:useBean id="cityBean" class="beanPackage.CityBean" scope="request"  />
Boston <input type="radio" name="city" value="Boston" <%= cityBean.getCityRadio("Boston") %>>
<br>
Buffalo <input type="radio" name="city" value="Buffalo" <%= cityBean.getCityRadio("Buffalo") %>>
<br>
Portland <input type="radio" name="city" value="Portland" <%= cityBean.getCityRadio("Portland") %>>My attempt to use EL instead of Scriptlet does not work with any of the below attempts. None of my EL attempts show any checked value or the check shows up only at the last radio button only.
//tried this:
Buffalo <input type="radio" name="city" value="Buffalo" ${cityBean.cityRadio["Buffalo"]}>>
Portland <input type="radio" name="city" value="Portland" ${cityBean.cityRadio["Portland"]}>>
//tried this:
Portland <input type="radio" name="city" value="Portland" ${cityBean.cityRadio[city]}>>
//tried this:
Portland <input type="radio" name="city" value="Portland" ${cityRadio[cityBean.city]}>>
//tried this:
Portland <input type="radio" name="city" value="Portland" ${getCityRadio[cityBean.city]}>>

You have in fact discovered one of the cases where there is no direct mapping between java code and EL : Calling a method that takes parameters.
There is no way to do this in EL. You can't directly call methods that don't follow the getter/setter pattern.
There are a few possible ways around this
1: Put the condiitional logic onto the JSP page:
Boston <input type="radio" name="city" value="Boston" <c:if test="${cityBean.city=='Boston'"}checked</c:if>>
<br>
Buffalo <input type="radio" name="city" value="Buffalo" <c:if test="${cityBean.city=='Buffalo'"}checked</c:if>>
<br>
Portland <input type="radio" name="city" value="Portland" <c:if test="${cityBean.city=='Portland'"}checked</c:if>>Hey, its view logic in any case. Why not?
This is in fact a prime case for a custom tag.
Particularly since you are referencing each value 3 times in each line of code here.
A better approach would be to have
- a list of values {Boston, Buffalo, Portland} - in an attribute called "cityList"
- The currently selected value (eg Buffalo) (currently in cityBean.city)
and then loop over your entire list, checking it against the currently selected value.
<jsp:useBean id="cityBean" class="beanPackage.CityBean" scope="request"  />
<c:forEach var="city" items="${cityList}">
   ${city}<input type="radio" name="city" value="${city}" <c:if test="${cityBean.city==city"}checked</c:if>>
</c:forEach>cheers,
evnafets

Similar Messages

  • How do i eliminate in downloaded forms "FORMTEXT" so i can print them

    How do I eliminate in downloaded forms "FORMTEXT" which is in areas that i would fill in manually by hand. When I print they have that in the space. Thanks

    Did you try filling them in with your info ? Maybe FORMTEXT will be eliminated once you make a non-blank entry.

  • How to eliminate  select message  after Radio button in ADF tables

    how to eliminate select message after Radio button in ADF tables
    example <f:facet name="selection">
    <af:tableSelectOne>
    </af:tableSelectOne>
    </f:facet>
    output:
    radobutton select
    radiobutton select
    please help me regarding this issue.

    Hi,
    this usually has a text String in the header saying "Select and .." which can be changed through the property inspector for the TableSelectOne component
    Frank

  • Form Radio Buttons or Checkboxes not created in Acrobat 9 Pro

    If this needs to be placed in another forum, please just let me know.
    I am using Acrobat 9 Pro - current version - 9.4.3.
    I am using Word 2010
    I am running Windows 7
    I have created a simple form in Word.  Using the guidelines from the white paper - Acro9_designforms.pdf provided by Adobe, those fields where I want a radio button insert a checkbox instead when running the Form Wizard in Acrobat.
    My sample is exactly the same as in the sample used in the white paper.
    I used a circle symbol from the Wingdings font, as recommended by Adobe.
    Salutation
    O Mr.
    O Ms.
    O Dr.
    The end result is still a checkbox, even though it is a circle in the display.
    What am I doing wrong?
    I do not want to use LiveCycle Designer, as once the form is created in LiveCycle, the form fields can no longer be edited in Acrobat and I must maintain the ability to edit in Acrobat.
    Thank you for your assistance.

    Oh, the Wizard is a fabulous tool for basic forms.  And, since Adobe has given an extensive list of 'guidelines', which is what I am testing, I thought I would ask for feedback from those who do use it and from those who have had success in using it.
    The Wizard is mostly terrific, if you use the guidelines when setting up the source document.  It saves a lot of manual field creation and fixing later.  This one, though, is not working as expected.   So, I might be doing something wrong and the responses I seek are from those who have had success with the feature - not with manual workarounds, which of course we know can be achieved.  :)
    Nothing is "magic".  I don't think either I or Adobe are implying that it should be.  However, when they state a feature works in a certain way and I am not getting those results, I like to explore why.  Silly me.  hahaha
    The example I gave in my initial post is the only thing in the form, as I am testing the features for when I present this topic.
    I am merely trying to determine if others are having success (or not) when creating their document initially in Word (for example), using the guidelines that Adobe states for Radio Buttons being created.  If there is a certain font that someone is having success with other than those stated by Adobe, I would love to know. For me, so far, it is not.  If it's user error, then I would love to know from someone who has had success.
    Here is what Adobe states as part of their Radio Button form field guidelines when setting up a document in Word, for example:
    § Use circular objects or numbered buttons to in a single row or column to indicate radio buttons.
    § Use group labels to the left of or above each radio button group – otherwise they will default to check boxes. Field names are determined from the group labels and individual button labels from the text to the right of each location.
    § Use the following text labels to have radio buttons created automatically: Yes/No, M/F, Male/Female, Mr/Mrs/Miss/Dr.
    § Use one of the following group labels to have radio buttons created automatically: Salutation, Sex, Occupation.
    thanks

  • Acrobat 9-forms-Radio buttons print different than check boxes

    I am using Acrobat Pro 9 to create forms.
    I've used both radio buttons and check boxes (that are circles).
    Forms were designed in InDesign with Zapf Dingbats as the open circles to be filled in.
    I used radio buttons when the user had to pick one over the other.
    I used check boxes when there were multiple choices or I wanted the user to be able to uncheck a box. (I used the circle style so they would look like radio buttons).
    The radio buttons are printing differently than the check boxes. It looks almost like there is an overlay on top of the actual open circle created by Zapf Dingbats.
    I checked the "appearance" window and there is no border or fill color on the radio buttons (same for the check boxes).
    Under the <general> tab, <common properties> is visible. I'm assuming it should be in order for the radio button to appear on the form.
    I would appreciate any input as to how to fix this.
    Thansk!
    Maureen

    That's just the way radio buttons are, and one reason I rarely use them in preference to check boxes. If Adobe wanted to, they could allow you to use any appearance you want for both the selected an unselected state of a check box or radio button, but they've actually further restricted your options over the years.

  • Adobe Form- Radio Button!!

    Hi Experts,
    I am working on the Adobe Form in which the data is coming from the Backend RFC. So my DataSource is binded to the Bapi node.
    Now my requirement is to add Radio Button for which I have defined in the Dictionary SimpleTypes and binded an attribute to it.
    The problem is since my DataSource in the PDF Form is already binded to the Bapi node I cant get the data for the Radoi button from the attribute(Dictionary simpleType).
    Can somebody suggest me how to go about it in my case. Any useful Help will be given points.
    thanks,
    Vikram..

    Hi,
    You will have to define a value node and then copy values from model node to value node. This way you can define additional attrbute apart from the atributes for data.
    Let me know if you have any problems.
    Regards,
    Ashutosh

  • Controling HTML form Radio Button

    I'm working on automating the check-in and check-out of items in a process queue, but the process queue is web-based. I can input usernames, lot IDs, passwords, and "press" submit buttons programatically by using ActiveX IWebBrowser2 properties (and related).
    Here's what I currently have, mostly stolen from a post from 2005.
    The Old Post:
    http://forums.ni.com/t5/LabVIEW/How-to-fill-out-and-submit-a-web-form-using-LabVIEW/m-p/1018248/high...
    As I said, I can input usernames and passwords and submit the form, but I am having trouble setting the value of a Radio button.
    Here's a snippit of what I'm trying, and my VI is attached. I've also attached the relevant HTML.
    Solved!
    Go to Solution.
    Attachments:
    web page radio button HTML.txt ‏2 KB
    WIPTrac experiments.vi ‏23 KB

      Hello,
    I have a html form compounds in two fields first and last name and a sibmit button, how can I control it in labview
    Attachments:
    form.png ‏60 KB
    forme.vi ‏19 KB
    form.txt ‏1 KB

  • PHP Form Radio button

    Hello,
    I would like to change an existing list to a radio option on
    my pho form.
    http://opie.monkeyshrine.com/contact/contactus.php
    From this
    <select name="reason" value="<?php
    if(isset($_POST['reason'])) echo
    htmlentities($_POST['reason']);?>" tabindex="4" size="1"
    id="reason">
    <option selected>Tell Us Why</option>
    <option value="Beijing to Moscow">Beijing to
    Moscow</option>
    <option value="Moscow to Beijing">Moscow to
    Beijing</option>
    <option value="Vladivostok to Moscow">Vladivostok to
    Moscow</option>
    <option value="Beijing back to Beijing">Beijing back
    to Beijing</option>
    <option value="Only Mongolia">Only
    Mongolia</option>
    <option value="Tranzip Direct Options">Tranzip Direct
    Options</option>
    <option value="Other Reason">Other
    Reason</option>
    </select>
    to
    <input type="radio" name="trip" value="<?php
    if(isset($_POST['BM'])) echo htmlentities($_POST['BM']);?>"
    /> Beijing to Moscow</label>
    <br />
    <label>
    <input type="radio" name="trip" value="<?php
    if(isset($_POST['VM'])) echo htmlentities($_POST['VM']);?>"
    /> Vladivostok to Moscow</label>
    <br />
    <label>
    <input type="radio" name="trip" value="<?php
    if(isset($_POST['MB'])) echo htmlentities($_POST['MB']);?>"
    /> Moscow to Beijing</label>
    <br />
    <label>
    <input type="radio" name="trip" value="<?php
    if(isset($_POST['BB'])) echo htmlentities($_POST['BB']);?>"
    /> Beijing back to Beijing</label>
    <br />
    <label>
    <input type="radio" name="trip" value="<?php
    if(isset($_POST['Mongolia'])) echo
    htmlentities($_POST['Mongolia']);?>" />Only
    Mongolia</label>
    <br />
    <label>
    <input type="radio" name="trip" value="<?php
    if(isset($_POST['Direct'])) echo
    htmlentities($_POST['Direct']);?>" />Tranzip Direct
    Options</label>
    <br />
    <label>
    <input type="radio" name="trip" value="<?php
    if(isset($_POST['unsure'])) echo
    htmlentities($_POST['unsure']);?>" />
    Unsure
    except, I have done the group radio wrong and it doesn't
    insert anything on the reply.
    Here is the php post code
    $Indhold .= "Trip Type: ".$_POST['trip']."\n";
    $Indhold .= "\r";
    $Indhold .= "Why: ".$_POST['reason']."\n";
    $Indhold .= "\r";
    Please help me correct the radio group.
    Thanks.
    ps. can you also confirm the local time is displaying your
    local time?

    On Fri, 24 Nov 2006 08:08:32 +0000 (UTC), "yesmaybe"
    <[email protected]> wrote:
    > Please help me correct the radio group.
    Doesn't this (test page) do what you want? Try it DW.
    <?php
    if ( isset($_POST['clicked']) && $_POST['clicked'] ==
    'true' ) {
    echo "Trip Type: ".$_POST['trip'];
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="">
    <input type="radio" name="trip" value="BM"
    /> Beijing to
    Moscow</label>
    <br />
    <label>
    <input type="radio" name="trip"
    value="VM" /> Vladivostok to
    Moscow</label>
    <br />
    <label>
    <input type="radio" name="trip"
    value="MB" /> Moscow to
    Beijing</label>
    <br />
    <label>
    <input type="radio" name="trip"
    value="BB" /> Beijing back to
    Beijing</label>
    <br />
    <label>
    <input type="radio" name="trip"
    value="Mongolia" />Only
    Mongolia</label>
    <br />
    <label>
    <input type="radio" name="trip"
    value="Direct" />Tranzip
    Direct Options</label>
    <br />
    <label>
    <input type="radio" name="trip"
    value="unsure" />
    Unsure </label>
    <input type="submit" name="Submit"
    value="Submit">
    <input name="clicked" type="hidden"
    id="clicked" value="true">
    </form>
    </body>
    </html>
    Steve
    steve at flyingtigerwebdesign dot com

  • Forms- Radio buttons

    Hi,
    I've got a form that has radio buttons included which work fine. But what I want is, when a particular radio button is clicked then a new sub-menu will appear, and there will be a different sub-menu for each radio button. Apologies if I haven't explained it that well but I will post any clarifications should you need them.
    Thanks.

    You want to do a search for javascript and dependant radio buttons.  You should be able to get a script pretty quick.
    Gary

  • Forms - Radio Buttons as check boxes which turn into circles - Need them to stay as check boxes.

    Hi
    I am working on some forms for Teachers Reports it is a generic document for student reports. I have set the document in Indesign 6 and edited the pdf form in Acrobat Pro.
    The form consists of Radio Buttons (Check Boxes) as they have to score the child between 1-4 and the teacher is only allowed to select 1 box from out of the 4 boxes (hence radio buttons) .
    The problem we are having is that there might be 2-3 teachers that have to write and score each child's in a certain section of the report and they might use a PC or MAC to do this.
    For some reason, some of the reports have changed the Radio Button "Check Boxes" to a "Circle" both in the PDF and when printing and they need it to be a Check box. (In indesign this was set to Check Box and to print as a Check box)
    Some how after the teachers have used different computers the check boxes have changed to circles and we need to change them back to check boxes but is there a way to change them without having to go "Forms" > "Edit" > "Select all circles" > "Properties" > "Options" > "Button Styles" > "Change to Check".
    But it is not changing to all of the reports on some.
    Is there an easier option can select properties and search the "circles" and change to "check boxes" for the whole document?
    I really don't want to have to go into each report and have to change each individually or export and import the data in the forms and the teachers dont want to have to rewrite each report.
    Someone please help!

    Are all of the teachers using Adobe Reader (or Acrobat), as opposed to something like Preview on tha Mac or Microsoft Reader on Windows? Preview is known to corrupts PDF form in a number of ways, including converting radio buttons to check boxes. Microsoft Reader causes other types of corruption. Also, if you create the fields in InDesign, it uses non-standard appearances for the various states and even Reader/Acrobat doesn't always set them in the way you might expect, so it's best to create them in Acrobat.
    Your description is a bit confusing since you're calling them radio buttons and check boxes at the same time. Can you clarify what the original field type is?
    It is possible to set the various field appearance properties with a script, which could loop through all of the fields and make the needed changes, but without more information about what's causing the changes and exactly what the changes are, it's hard to suggest anything specific.

  • Cant fill a form (radio button)

    Hey.
    I frequently need to fill a form and I cant do so with my Ipad because at certain point I need to select an option with a radio button and the Ipad doesnt recognize it. The form also has square box and there I dont have a problem, I can check it. But when it comes to the radio (circular) button, I cant hit it and fill it.
    Why is this so?
    Thanks.
    (Sorry for my poor english)

    Radio button can be selected using the Safari App on the iPad, but the website has to be at least somewhat coded for mobile viewing.  See if you can zoom in on the screen before tapping the radio button, this sometimes help.  If in the end, you are still unable to complete it, try another browser like Chrome.  Some websites don't play nice with mobile devices and touch screens so you may get mixed results.  Apple uses Radio buttons in the forgot.apple.com website as well as many other I'm assuming and they all function fine from the iPad screen, so it is more than likely just the website you are utilizing.  Good Luck.

  • Form/Radio Button/Email Question

    How can I fix the form on http://www.cec-waterjet.com/Contact/index.html so that it sends an email to the contact whose radio button is selected?

    The script you have now should work, it's just not very secure. I meant find a different script where, instead of entering the actual email address in the recipient field, you entered a key or index that points to the address that's been entered somewhere in the script or configuration file, so the email address isn't anywhere in the HTML. I've got an (old-ish) PHP script that works that way here:
    http://www.mindpalette.com/scripts/index.php#NMAnchor
    ...but if you need another CGI script like you've already got, I don't have any specific recommendations, sorry. It was just a suggestion :-)
    I removed your code from your message #2 to try to prevent that from getting spam harvested.

  • Eliminate Scriptlet condtions in JSP

    I have a Servlet that checks for information and if there is an issue it forwards the message to presentation page (JSP). Now I want to stop using conditions in scriptlets in the JSP. Please advise how I can do it in this situation in my Tomcat 4.1.27 container:
    Servlet that forwards to JSP:
    String gotopage = "";
    if(mydata == 1)
         gotopage = /"pager.jsp?mymessage=err";
    else if(mydata == 34
       gotopage = /"pager.jsp?mymessage=duper";
    else
        gotopage = /"pager.jsp?mymessage=proc";
    RequestDispatcher dispatcher =
      getServletContext().getRequestDispatcher(gotopage);     
    dispatcher.forward(request, response);
    ...JSP
    <%
    String mymessage = request.getParameter("mymessage")
    if(mymessage.equals("err"))
         out.println("Error on the page");
    else if(mymessage.equals("dup"))
         out.println("Duplicate issue.");
    else if(mymessage.equals("proc"))
         out.println("Process message issue");
    %>I was thinking maybe a bean or regular Java class to handle this but not sure how. Here would be my method in a Java class:
    public void getMessage(String msg)
         if(msg.equals("err"))
             out.println("Error on the page");
    }Then I would put the method in a bean or what in JSP?
    The Servlet would stay the same?

    Put it in a bean or learn JSTL.
    OR you could just put the message you want to display into page scope and have the JSP display it. Since the servlet already knows which page it's sending, let it figure out what the message should be, too.
    no need for all that logic in the page.
    do learn JSTL. Scriptlet code is very bad for maintenance.
    %

  • Help needed in setting form values

    I have following fields in the form
    Radio boxes - Grant and Deny
    Text Area - User comments
    Buttons - Submit Cancel
    I want the user comments field 'Required' only when we select 'Deny' option
    For Grant- it should not be required.
    If we select Deny option and click on Submit, it should say - Missing Value in the required field - User Comments.
    Please guide.

    I added a validation on Subit button as -
    If user commets are null and deny is selected - give error message..
    It worked.

  • Send an input form via CFMAIL?

    I've created an input form (radio buttons, text input) on our site that uses CFMAIL to send the results to the business, then updates our SQL DB. The user/client gets to the form by clicking on a survey link in an email sent to them.
    Now, I've been asked to include the actual input form in the email sent to the user so that the user fills out the input form inside the HTML email instead of clicking on the survey link to get to the site.
    I'm a bit confused as I haven't seen much helpful information on this topic. If the user has HTML enabled on their email client, and if I validate the data coming in, can this work? Is there anything else I should be aware of as far as Coldfusion is concerned?

    Try it from your own email client.
    Things to be aware of.
    You can't use any cold fusion tags on the form.
    It might not work with lotus notes because that converts html to rich text.

Maybe you are looking for

  • I am trying to extract two more fields from 2lis_13_vditm

    Dear Experts, I have some tough situation here. In BW: i am using 2lis_13_vditm this datasource for the last 5 years. i am running daily deltas to load(10 fields from r/3) ods which is in <b>addition mode.</b>. from this ods data is going to another

  • Transport of object from Quality to Production.

    Hi, I am a technical designer and have a limited understanding on the transport management system and basis. I had recently created an object on the development system and provided my user with the transport request number. She had moved it to Qualit

  • Is there something wrong with my iPhone 5?

    Since i've had my iPhone 5 it's been working perfectly until about a month ago. Chargers won't last longer than a week. Some have been from Apple, some have been cheep ones. Recently, some won't even last more than 2 days. My phone can be on charge f

  • Excel 2013 installed through 365 crashes when small row is in spreadsheet

    Hi, I have major issue with Excel files that makes Excel stop working when trying to print. Excel crashes already at the preview pane and it has nothing todo with print driver, it crashes if using the XPS driver as well. Using Excel installed locally

  • Bridge CS5 doesn't recognize my HTC Incredible 2 smartphone.

    When I configure my HTC Incredible 2 smartphone to connect to my Windows 7 OS as another drive and plug it into a USB port, it recognizes the drive as a camera or card reader but produces the error message: "Failed to obtain thumbnails from the devic