[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

Valid format of <OPTION <%= range.equalsIgnoreCase(" ") ? "selected" : "" %> > </OPTION>

I am having a jsp page with option tag as below which is not being recognised. Could someone give an alternative to the below statement, as an option tag only.

<OPTION <%= range.equalsIgnoreCase("Yesterday") ? "selected" : "" %>>Yesterday</OPTION>
0
prsubject
Asked:
prsubject
  • 11
  • 7
  • 3
1 Solution
 
prsubjectAuthor Commented:
I am getting the error option tag not closed. I have even turned off the validators of jsp in eclipse. This is the only error that is being shown and is stopping me from deploying the war file on oracle weblogic.
0
 
prsubjectAuthor Commented:
This is what I have

            <SELECT NAME="range" onChange="javascript:setDateRange()">
          <OPTION <%= range.equalsIgnoreCase(" ") ? "selected" : "" %> > </OPTION>
          <OPTION <%= range.equalsIgnoreCase("All Times") ? "selected" : "" %> >All Times</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Yesterday") ? "selected" : "" %>>Yesterday</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Today") ? "selected" : "" %>>Today</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Tomarrow") ? "selected" : "" %>>Tomorrow</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Last Week") ? "selected" : "" %>>Last Week</OPTION>
          <OPTION <%= range.equalsIgnoreCase("This Week") ? "selected" : "" %>>This Week</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Next Week") ? "selected" : "" %>>Next Week</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Last Month") ? "selected" : "" %>>Last Month</OPTION>
          <OPTION <%= range.equalsIgnoreCase("This Month") ? "selected" : "" %>>This Month</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Next Month") ? "selected" : "" %>>Next Month</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Last Qtr") ? "selected" : "" %>>Last Qtr</OPTION>
          <OPTION <%= range.equalsIgnoreCase("This Qtr") ? "selected" : "" %>>This Qtr</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Next Qtr") ? "selected" : "" %>>Next Qtr</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Last Year") ? "selected" : "" %>>Last Year</OPTION>
          <OPTION <%= range.equalsIgnoreCase("This Year") ? "selected" : "" %>>This Year</OPTION>
          <OPTION <%= range.equalsIgnoreCase("Next Year") ? "selected" : "" %>>Next Year</OPTION>
        </SELECT>
0
 
prsubjectAuthor Commented:
This is the javascript

function setDateRange()
{
      // Note: Do not use endTime = startTime. This assigns startTime and EndTime
      // to the same object reference.

      // getDay() sun=0, mon=1, tue=2, wed=3, thur=4, fri=5, sat = 6

    var qtrStart = new Array
      (
        new Date(2099, 0, 1, 0, 0, 0, 0),
        new Date(2099, 3, 1, 0, 0, 0, 0),
        new Date(2099, 6, 1, 0, 0, 0, 0),
        new Date(2099, 9, 1, 0, 0, 0, 0)
      );

         var qtrEnd = new Array
      (
        new Date(2099, 2, 31, 23, 59, 59, 999),
        new Date(2099, 5, 30, 23, 59, 59, 999),
        new Date(2099, 8, 30, 23, 59, 59, 999),
        new Date(2099, 11, 31, 23, 59, 59, 999)
    );

      var range = getSelected(document.myForm.range);

    var startTime = new Date();
    var endTime   = new Date(startTime.getTime());

    if (range == "All Times")
    {
            startTime = new Date(document.myForm.startYear.options[0].text, 0, 1, 0, 0, 0, 0);
            endTime   = new Date(document.myForm.endYear.options[document.myForm.endYear.length-1].text, 11, 31, 23, 59, 59, 999);
      }
      else if (range == "Yesterday")
    {
            startTime.setDate(startTime.getDate() - 1);
            endTime.setTime(startTime.getTime());
    }
      else if (range == "Today")
    {
            // Nothing
      }
    else if (range == "Tomorrow")
    {
        startTime.setTime(startTime.getTime() + 24*60*60*1000);
          endTime.setTime(startTime.getTime());
    }
    else if (range == "Last Week")
    {
            startTime.setDate(startTime.getDate() - startTime.getDay() - 7);
                 endTime.setTime(startTime.getTime());
            endTime.setDate(startTime.getDate() + 6);
      }
    else if (range == "This Week")
    {
            startTime.setDate(startTime.getDate() - startTime.getDay());
            endTime.setTime(startTime.getTime());
            endTime.setDate(startTime.getDate() + 6);
    }
    else if (range == "Next Week")
    {
            startTime.setDate(startTime.getDate() - startTime.getDay() + 7);
                 endTime.setTime(startTime.getTime());
            endTime.setDate(startTime.getDate() + 6);
    }
    else if (range == "Last Month")
    {
            var month = startTime.getMonth() - 1
            new java.util.Date();
            startTime.setMonth(month, 1);
            new java.util.Date();
            endTime.setMonth(month, 31);
    }
    else if (range == "This Month")
    {
            startTime.setDate(1);
            endTime.setDate(31);
    }
    else if (range == "Next Month")
    {
            var month = startTime.getMonth() + 1
            startTime.setMonth(month, 1);
            endTime.setMonth(month, 31);
    }
    else if (range == "Last Year")
    {
            var year = startTime.getYear() + 1900 - 1
            startTime.setMonth(0, 1);
            startTime.setYear(year);
            endTime.setMonth(11, 31);
            endTime.setYear(year);
    }
    else if (range == "This Year")
    {
            startTime.setMonth(0, 1)
            endTime.setMonth(11, 31)
    }
    else if (range == "Next Year")
    {
            var year = startTime.getYear() + 1900 + 1
            startTime.setMonth(0, 1);
            startTime.setYear(year);
            endTime.setMonth(11, 31);
            endTime.setYear(year);
    }
    else if (range == "Last Qtr")
    {
            var qtr = Math.floor(startTime.getMonth() / 3);
            qtr = qtr - 1;

            var year = startTime.getYear() + 1900;
            if (qtr <= 0 )
            {
                  qtr = 3;
                  year = year - 1;
            }

            startTime.setTime(qtrStart[qtr].getTime());
            startTime.setYear(year);

            endTime.setTime(qtrEnd[qtr].getTime());
            endTime.setYear(year);
      }
    else if (range == "This Qtr")
    {
            var qtr = Math.floor(startTime.getMonth() / 3);
            var year = startTime.getYear() + 1900;
            
            startTime.setTime(qtrStart[qtr].getTime());
            startTime.setYear(year);

            endTime.setTime(qtrEnd[qtr].getTime());
            endTime.setYear(year);
    }
    else if (range == "Next Qtr")
    {
            var qtr = Math.floor(startTime.getMonth() / 3);
            qtr = qtr + 1;

            var year = startTime.getYear() + 1900;
            if (qtr >= 3 )
            {
                  qtr = 0;
                  year = year + 1;
            }
            startTime.setTime(qtrStart[qtr].getTime());
            startTime.setYear(year);
            
            endTime.setTime(qtrEnd[qtr].getTime());
            endTime.setYear(year);
    }

      // Adjust times to start and end of day
      startTime.setHours(0);
      startTime.setMinutes(0);
      startTime.setSeconds(0);

      endTime.setHours(11);
      endTime.setMinutes(59);
      endTime.setSeconds(59);

      // Set the date fields in the form
      setSelect(document.myForm.startDay, startTime.getDate());
      setSelect(document.myForm.startMonth, startTime.getMonth()+1);
      setSelect(document.myForm.startYear, startTime.getFullYear());

      setSelect(document.myForm.endDay, endTime.getDate());
      setSelect(document.myForm.endMonth, endTime.getMonth()+1);
      setSelect(document.myForm.endYear, endTime.getFullYear());
}
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
mrcoffee365Commented:
Again, I have no problem with this code, running in Tomcat5 or 6.

You say you are running this in eclipse, but your eventual server is weblogic.  Which one gives you the error?

Please post the full exception -- that might help track down the real problem.
0
 
Pramod KumarCommented:
Please ensure:
1) code is written in a JSP file
2) JSP file is deployed on a web server (tomcat, weblogic, websphere etc.)
3) JSP is being accessed from a web-browser.
0
 
prsubjectAuthor Commented:
The code is written in JSP file. The server that is giving the error is weblogic. It is not allowing me to deploy from eclipse environment. At the time I right click on the project and say publish it is not getting deployed saying the project contains errors and the error is Option tag not ended properly.
0
 
mrcoffee365Commented:
Okay -- please post the exception or error messages.   You say that weblogic is giving you the error, but you are actually seeing the error in the eclipse console, right?  Post that error message here.
0
 
mrcoffee365Commented:
Also - please post which versions of eclipse and weblogic you are using.  There seem to have been problems specifically with weblogic deployments because of non-standard jars in weblogic.
0
 
prsubjectAuthor Commented:
I am using eclipse helio.
The error message
Error(s) found in module 'NewDirAdmin'. Publish was cancelled. See "Problems" view for details.
Start tag (<OPTION>) not closed. at DateRange.inc --> DateRange.inc is the name of the file which contains this option tag
Start tag (<OPTION>) not closed. at DateRange.inc
Start tag (<OPTION>) not closed. at DateRange.inc


Nothing is being displayed on the console.

The Markers tab on Eclipse says.

Description      Resource      Path      Location      Type
Start tag (<OPTION>) not closed.      DateRange.inc      /NewDirAdmin/WebContent/includes      line 241      HTML Problem
0
 
prsubjectAuthor Commented:
I have removed all the jsp validations in eclipse IDE.
0
 
prsubjectAuthor Commented:
The weblogic version is 10gR3. It is actually Oracle Weblogic.
0
 
prsubjectAuthor Commented:
Help Please.
0
 
mrcoffee365Commented:
Can you try changing the name of DateRange.inc to DateRange.jsp?  Make sure to change the include line in your outer jsp file to match the new name as well.

0
 
prsubjectAuthor Commented:
The error is gone. Real big thanks.
0
 
prsubjectAuthor Commented:
Something has gone wrong. I have accepted the answer given by mrcoffee365 and have even increased the points awarded fron 250 to 500. I need this points to be awarded to mrcoffee365.
0
 
prsubjectAuthor Commented:
I would like to ask a question out of curiosity. Why has the .inc file thrown errors.
0
 
mrcoffee365Commented:
I believe that it's a problem with Eclipse.  Eclipse is a great IDE, but for some reason they did a bad job with JSP file interpretation.  Eclipse insists on evaluating each included file as if it were an independent file, then putting them together into the whole JSP page.   So since the .inc file did not have the .jsp extension, it was evaluated as ... plain html?  I don't know what the  Eclipse default is, but it sounds as if it was evaluated as html.  When it didn't parse correctly as plain html, Eclipse gave you that error without combining the .inc into the final .jsp file and evaluating the final.

This problem is much worse with .jspf files, which are frequently not valid by themselves, but only when included into the outer .jsp files.

However, usually it's possible to refactor the component  .jsp files so that they pass evaluation with Eclipse and they can be included in the outer .jsp files.  Eclipse is a great IDE, but it has some quirks.
0
 
Pramod KumarCommented:
@prsubject,

I have already given you the accepted solution much more earlier in ID: 34162425 and could you please tell us why it was not accepted.

Regards
0
 
mrcoffee365Commented:
pramodkrjsr: Your response was not an answer.  You simply listed information which had already been mentioned in the question -- that this involved jsp pages, a web server, and a browser.
0
 
Pramod KumarCommented:
@mrcoffee365,
Yes, in the question it was told that the file is a JSP, but actually it was .inc

I suspected that there may be a chance that the file extension is not a JSP and suggested to re-check and you gave the same solution.

Regards
0
 
mrcoffee365Commented:
pramodkrjsr: You did not suggest that the problem was that there was an included .inc file.  And, that was not precisely the problem -- it was a quirk of Eclipse.

There is no problem with compiling jsp files which include files of any extension.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 11
  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now