How to compare a string with integer in jsp

I have a field in database called as enddate
i m trying to split the entire date and get date,month and year
once i store the date in a variable called as fmdate which is string,
i need to compare it with another integer.
how can i compare it..heres my code
stdate=RS.getString("start_date");
     fmdate=stdate.substring(8,10);
     fmmonth=stdate.substring(5,7);
     fmyear=stdate.substring(0,4);
and this is where i want to compare the value of j to fmday...
<td class="btext" valign="center">Day<select name="fmday">
<%
for(int j=1;j<=31;j++)
String s;
parseInt(s)=j;
if (fmdate.equals(s))
%>
<option value="<%=j%>"><%=j%></option>
<% } else { %>
<option value="<%=j%>"><%=j%></option>
<%
} %>
</select>
pl help me...
Thanks Srini

j is an int, so you're just adding 0, not concatenating. Perhaps something like this would work.
<%
  for(int j=1;j<=31;j++)
     String date = String.valueOf(j);
     if(j <= 9) {
        date = 0 + date;
     if (fmdate.equals(date)) {
%>
  <option value="<%=date%>"><%=date%></option>
<%
     } else {
%>
  <option value="<%=date%>"><%=date%></option>
<%
%>Uhm, I assume there should be a 'selected' or something in one of the option tags?

Similar Messages

  • How to compare German strings with umlaut

    hi
    here is a solution for the problem to compare German strings containing umlaut, which I faced and where I did not find any solution yet!
    The right thing is to use the RuleBasedCollator class and define the additional rules (concerning the umlaut) by yourself and setting the strength of the rule interpretation to PRIMARY!
    Here is the code that works:
    public class UmlautTest { 
    public static void main (String args[]) {    
    String st1 = "Daettenb�ck";
    String st2 = "D�ttenbueck";
    String myRule = "< ae,�,AE,� < oe,�,OE,� < ss,�,SS < ue,�,UE,�";
    RuleBasedCollator myrbCol = null;
    try {
    myrbCol = new RuleBasedCollator(myRule);
    } catch (ParseException e) {
    e.printStackTrace();
    myrbCol.setStrength(Collator.PRIMARY);
    if (myrbCol.compare(st1, st2) != 0) {
    System.out.println("myrbCol: NICHT gleich!");
    } else {
    System.out.println("myrbCol: Gleich!");
    I hope that I could help anyone with that
    nocomm

    The � should be of course replaced by the missing umlaut!
    Sorry, but I didn't preview the topic!
    nocomm

  • How to compare two strings with each other?

    Hello,
    I have modeled a formular which has a radio group and a button. Furthermore, I have one result state corresponding to each option in the radio group.
    In order to determine which result state actually is to be reached I want to attach a condition to each flow to the result states that tests which option has been chosen.
    Which operator can I use for writing these conditions? I have tried the "like" operator as well as the "==" operator but neither seems to work.
    I have written something like:
    =LIKE(@decision, 'option a')
    as well as:
    =(@decision=='option a')
    What am I doing wrong here?
    Thank you very much
    Alexander

    Hi Alexander,
    Could this be an Upper/Lower case issue.
    I tried the following expression
    =(@TXT1=="opt a")
    and it worked.
    If you want your expression to ignore case you should use this expression:
    =(UPPER(@TXT1)==UPPER("opt a"))
    In case you're not sure what is the exact string in the field (@decision) you can always use the PROMPT action to display the field's value.
    Regards,
    Udi

  • How to compare two strings whether both are equal while ignoring the difference in special characters (example: & vs & and many others)?

    I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
    One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
    The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
    Snapshot of different design & same symbols:
    Is it due to different culture or language?
    How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?

    Hi Jerioon,
    If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
    You can use the below solution.
    Before comparing pass the variables through a replace function to standarize the char set.
    $Var = Replace($Var,"&","&")
    This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
    Similar technique is used to ignore Character Cases 'a' vs. 'A'
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • How to create a String with a specific size?

    how to create a String with a specific size?
    For example I want to create different Strings with the size of 100 , 1000 or 63k byte?

    String are immutable so just initialize it with the number of characters you want.
    You might want to look at java.lang.StringBuffer and see if that's what you want.

  • How to concatenate a string with single quotes

    Hi all,
        how to concatenate a string with single quotes to a variable.
    Sathya

    Hi sathyabama,
    1. simple
    2. use TILDE character <b>(`)</b>
       (just left to the '1' key)
    <b> `'mystring'`</b>
    3. just copy paste
    report abc.
    data : m(100) type c.
    concatenate `'amit mittal'` 'hello' into m separated  by space.
    write m.
    regards,
    amit m.

  • How to print a string with out using main method??

    how to print a string with out using main method??
    if we can tell me with example?
    thanks in adavance
    raja

    Hi,
    actually there's none. The UITableView class needs to "know" the tableView's height so either it can calc <number of rows> times <row height> or it has to sum the height of each single row.
    If the row which needs to be of different size always is the first or the last row you can user a tableHeader or tableFoot view.
    Regards
    Dirk

  • Can anybody tell how to compare two documents with two pointers controlled with the same mouse

    can anybody tell how to compare two documents with two pointers controlled with the same mouse ??

    I saw what I need but in a game to find the differences between two photos (two screens, two pointers controlled by one mouse), and I need a program to make the same thing   (compare a chosen files)

  • URGENT! I need to compare a String with a line in a .txt file

    I'm a college student and I have a very simple question i guess. I need to write an if procedure which compares if a line of a .txt file is equal to something, but I just don't know how to do it. HELP!

    What specifically are you asking for? How to compare two strings?
    String s = "cat";
    String t = "Cat";
    if (s.equals(t))
       System.out.println('They are equal');    // does not print out
    if (s.equalsIgnoreCase(t))
       System.out.println('They are equal');    // prints out

  • How to compare single value with multiple values

    In my query I have something like this:
    A.SOR_CD=B.SOR_CODE where A and B are 2 different tables. This condition is in the where clause. The column in table A has single values but some values in table B have multiple comma separated values (822, 869, 811, ..).  I want to match this single
    value on the left side with each of the comma separated values. Please let me know how will I be able to do it. The number of comma separated values on the right side may vary.

    Hi MadRad123,
    According to your description, you want to compare single value with multiple values in your query. Right?
    In this scenario, the table B has comma separated values, however those comma separated values are concatenated into a string. So we can use charindex() function to return the index of the table A value. And use this index as condition in
    your where clause. See the sample below:
    CREATE TABLE #temp1(
    ID nvarchar(50),
    Name nvarchar(50))
    INSERT INTO #temp1 VALUES
    ('1','A'),
    ('2','A'),
    ('3','A'),
    ('4','A'),
    ('5','A')
    CREATE TABLE #temp2(
    ID nvarchar(50),
    Name nvarchar(50))
    INSERT INTO #temp2 VALUES
    ('1','a,A'),
    ('2','A,B'),
    ('3','c'),
    ('4','A,C'),
    ('5','d')
    select * from #temp1 a inner join #temp2 b on a.ID=b.ID
    where CHARINDEX(a.Name,b.Name)>0
    The result looks like below:
    Reference:
    CHARINDEX (Transact-SQL)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Comparing a String with array elements

    i need some help as to how to compare an individual String with each item of a String array.
    so far i have:
    StringTokenizer drinksOrder = new StringTokenizer(orderLine, "\r");
    while (drinksOrder.hasMoreTokens())
         for (int index = 0; index < NUMBER_OF_DRINKS; index++)
                 barcode = drinksOrder.nextToken();
                        if (barcode.equals(barcodes[index]))
                                     name = drinks[index];
                                     price = prices[index];
                                     status = drinkStatus[index];
              orderedDrinkBC[j] = barcode;
                                              orderedDrinkName[j] = name;
                                              orderedDrinkPrice[j] = price;
                                              orderedDrinkStatus[j] = status;
              j++;
              break;
    [\CODE]
    At the moment, no Strings are being put in the orderedDrinkBC, orderedDrinkName, orderedDrinkPrice
    and orderedDrinkStatus arrays. the code seems to be failing on the 'barcode.equals(barcodes[index])
    part at the moment.
    any help would be appreciated
    cheers
    david                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Do this instead (next time post your code in lower case code tags):
    StringTokenizer drinksOrder = new StringTokenizer(orderLine, "\r");
    while (drinksOrder.hasMoreTokens())
      barcode = drinksOrder.nextToken();
      for (int index = 0; index < NUMBER_OF_DRINKS; index++)
        if (barcode.equals(barcodes[index]))
          name = drinks[index];
          price = prices[index];
          status = drinkStatus[index];
          orderedDrinkBC[j] = barcode;
          orderedDrinkName[j] = name;
          orderedDrinkPrice[j] = price;
          orderedDrinkStatus[j] = status;
          j++;
          break;
    }

  • How to create a String with comma ?

    Hi All,
    I have a table with 10 records(employee name) and i have to make a string
    with comma delimiter and at the end with "."
    Can anybody tell me how to write a Java program for this ?
    Thanks in advance.

    // I believe the following example gives you the answer.
    class stringEG {
         public static void main(String args[]) {
         String emprs[] ={"1","2","3","4","5","6","7","8","9","10"};
         String vempname = "";
         for(int i=0; i<emprs.length; i++) {
         if(i == (emprs.length-1))
              vempname = vempname + emprs[i] + ".";
         else
              vempname = vempname + emprs[i] + ", ";
         System.out.println("vempname : "+vempname);
    Here dont assume that I asked you to get all the results and putting
    it into the string arrays. But its a simple example to suit your requirement.
    The half-way coding below answers your question, I hope.
    vempname = "";
    while (emprs.next()) {
    if(emprs.isLast())
    vempname = vempname + emprs.getString("empname") + ".";
    else
    vempname = vempname + emprs.getString("empname") + ", ";
    // nats.

  • How to compare current date with past date

    Sample code for comparing current date with past date
    i dont want to Calender.set method to compare it.
    How can i do it?

    PLEASE stay with ONE thread:
    http://forum.java.sun.com/thread.jspa?threadID=5143991&tstart=0

  • How to concatenate a string with spaces

    Dear experts,
    I would like to concatenate a string with three spaces, for example,
    CONCATENATE 'X' SPACE SPACE SPACE 'Y' INTO LV_RESULT.
    However, the result I got from executing the above statement is not 'X   Y' as I want, but rather 'XY'.
    I did try
    CONCATENATE 'X' '***' 'Y' INTO LV_RESULT.
    REPLACE '***' with '   ' INTO LV_RESULT.
    still doesn't work.
    How can I write ABAP code to archive such a result?
    Any idea would be appreciated.
    Vitthavat A.

    dear  Oliver Hütköper and koolspy,
    I tried your solutions, and it works.
    so i awarded points to you.
    anyway, while trying the 'respecting blanks', i got an error:
    "".", "IN BYTE MODE", "SEPARATED BY ..." or "IN CHARACTER MODE" expected"
    not sure what it means. but it's ok. the problem has been solved.
    thanks again.

  • How to compare Sale data with Previous data

    Hi Guys,
        Any one tell me how we will compare Sales data with Last year Sale data. Is there any T.Code or any kind of Report in the SAP. If available please suggest the same.
    Thanks & regards,
    Naveen Bhatia

    Hi Naveen,
    Did yo ucheck t-code SD01
    Regards
    Rohit.

Maybe you are looking for

  • Property inspector not displaying properties

    Trivial problem: DAK why DW8 (8.0.2) Property inspector sometimes displays just "Div ID, Class and an Edit CSS button" when within a DIV? When in Code view in a correctly functioning page, most of the code will have detailed HTML properties displayed

  • Amsn worked mac to pc with isight imac g5 not working now

    Help. For a few months been talking to partner on their pc with amsn on my imac with built in cam. Partner got new pc. Now amsn is not sending my cam? Any ideas? Thanks

  • Delete transfer order

    hello, friends. i want to delete a delivery that has been previously billed.  the billing document has been cancelled and the goods issue reversed.  however, i could not use LT0G as the document items are locked.  i tried to cancel the transfer order

  • SCSM 2012 - Problems running script in custom workflow

    Hi all, I'm trying to create a custom workflow in the Authoring Tool that will send an email when a ticket in certain queues is unassigned, but I only want this to run during business hours. I've created the PowerShell script, and it runs great on it

  • RSS: XML Transformation exception

    I want to use the XMLProvider to make a rss channel. I know how to do this. But most of the time the channel does not work it says 'There has been an error while transforming the XML file!'. But sometimes the page does show my rss feed. The rss feed