prsubject
asked on
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("Ye sterday") ? "selected" : "" %>>Yesterday</OPTION>
<OPTION <%= range.equalsIgnoreCase("Ye
ASKER
This is what I have
<SELECT NAME="range" onChange="javascript:setDa teRange()" >
<OPTION <%= range.equalsIgnoreCase(" ") ? "selected" : "" %> > </OPTION>
<OPTION <%= range.equalsIgnoreCase("Al l Times") ? "selected" : "" %> >All Times</OPTION>
<OPTION <%= range.equalsIgnoreCase("Ye sterday") ? "selected" : "" %>>Yesterday</OPTION>
<OPTION <%= range.equalsIgnoreCase("To day") ? "selected" : "" %>>Today</OPTION>
<OPTION <%= range.equalsIgnoreCase("To marrow") ? "selected" : "" %>>Tomorrow</OPTION>
<OPTION <%= range.equalsIgnoreCase("La st Week") ? "selected" : "" %>>Last Week</OPTION>
<OPTION <%= range.equalsIgnoreCase("Th is Week") ? "selected" : "" %>>This Week</OPTION>
<OPTION <%= range.equalsIgnoreCase("Ne xt Week") ? "selected" : "" %>>Next Week</OPTION>
<OPTION <%= range.equalsIgnoreCase("La st Month") ? "selected" : "" %>>Last Month</OPTION>
<OPTION <%= range.equalsIgnoreCase("Th is Month") ? "selected" : "" %>>This Month</OPTION>
<OPTION <%= range.equalsIgnoreCase("Ne xt Month") ? "selected" : "" %>>Next Month</OPTION>
<OPTION <%= range.equalsIgnoreCase("La st Qtr") ? "selected" : "" %>>Last Qtr</OPTION>
<OPTION <%= range.equalsIgnoreCase("Th is Qtr") ? "selected" : "" %>>This Qtr</OPTION>
<OPTION <%= range.equalsIgnoreCase("Ne xt Qtr") ? "selected" : "" %>>Next Qtr</OPTION>
<OPTION <%= range.equalsIgnoreCase("La st Year") ? "selected" : "" %>>Last Year</OPTION>
<OPTION <%= range.equalsIgnoreCase("Th is Year") ? "selected" : "" %>>This Year</OPTION>
<OPTION <%= range.equalsIgnoreCase("Ne xt Year") ? "selected" : "" %>>Next Year</OPTION>
</SELECT>
<SELECT NAME="range" onChange="javascript:setDa
<OPTION <%= range.equalsIgnoreCase(" ") ? "selected" : "" %> > </OPTION>
<OPTION <%= range.equalsIgnoreCase("Al
<OPTION <%= range.equalsIgnoreCase("Ye
<OPTION <%= range.equalsIgnoreCase("To
<OPTION <%= range.equalsIgnoreCase("To
<OPTION <%= range.equalsIgnoreCase("La
<OPTION <%= range.equalsIgnoreCase("Th
<OPTION <%= range.equalsIgnoreCase("Ne
<OPTION <%= range.equalsIgnoreCase("La
<OPTION <%= range.equalsIgnoreCase("Th
<OPTION <%= range.equalsIgnoreCase("Ne
<OPTION <%= range.equalsIgnoreCase("La
<OPTION <%= range.equalsIgnoreCase("Th
<OPTION <%= range.equalsIgnoreCase("Ne
<OPTION <%= range.equalsIgnoreCase("La
<OPTION <%= range.equalsIgnoreCase("Th
<OPTION <%= range.equalsIgnoreCase("Ne
</SELECT>
ASKER
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.myFor m.range);
var startTime = new Date();
var endTime = new Date(startTime.getTime());
if (range == "All Times")
{
startTime = new Date(document.myForm.start Year.optio ns[0].text , 0, 1, 0, 0, 0, 0);
endTime = new Date(document.myForm.endYe ar.options [document. myForm.end Year.lengt h-1].text, 11, 31, 23, 59, 59, 999);
}
else if (range == "Yesterday")
{
startTime.setDate(startTim e.getDate( ) - 1);
endTime.setTime(startTime. getTime()) ;
}
else if (range == "Today")
{
// Nothing
}
else if (range == "Tomorrow")
{
startTime.setTime(startTim e.getTime( ) + 24*60*60*1000);
endTime.setTime(startTime. getTime()) ;
}
else if (range == "Last Week")
{
startTime.setDate(startTim e.getDate( ) - startTime.getDay() - 7);
endTime.setTime(startTime. getTime()) ;
endTime.setDate(startTime. getDate() + 6);
}
else if (range == "This Week")
{
startTime.setDate(startTim e.getDate( ) - startTime.getDay());
endTime.setTime(startTime. getTime()) ;
endTime.setDate(startTime. getDate() + 6);
}
else if (range == "Next Week")
{
startTime.setDate(startTim e.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.getMo nth() / 3);
qtr = qtr - 1;
var year = startTime.getYear() + 1900;
if (qtr <= 0 )
{
qtr = 3;
year = year - 1;
}
startTime.setTime(qtrStart [qtr].getT ime());
startTime.setYear(year);
endTime.setTime(qtrEnd[qtr ].getTime( ));
endTime.setYear(year);
}
else if (range == "This Qtr")
{
var qtr = Math.floor(startTime.getMo nth() / 3);
var year = startTime.getYear() + 1900;
startTime.setTime(qtrStart [qtr].getT ime());
startTime.setYear(year);
endTime.setTime(qtrEnd[qtr ].getTime( ));
endTime.setYear(year);
}
else if (range == "Next Qtr")
{
var qtr = Math.floor(startTime.getMo nth() / 3);
qtr = qtr + 1;
var year = startTime.getYear() + 1900;
if (qtr >= 3 )
{
qtr = 0;
year = year + 1;
}
startTime.setTime(qtrStart [qtr].getT ime());
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());
}
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.myFor
var startTime = new Date();
var endTime = new Date(startTime.getTime());
if (range == "All Times")
{
startTime = new Date(document.myForm.start
endTime = new Date(document.myForm.endYe
}
else if (range == "Yesterday")
{
startTime.setDate(startTim
endTime.setTime(startTime.
}
else if (range == "Today")
{
// Nothing
}
else if (range == "Tomorrow")
{
startTime.setTime(startTim
endTime.setTime(startTime.
}
else if (range == "Last Week")
{
startTime.setDate(startTim
endTime.setTime(startTime.
endTime.setDate(startTime.
}
else if (range == "This Week")
{
startTime.setDate(startTim
endTime.setTime(startTime.
endTime.setDate(startTime.
}
else if (range == "Next Week")
{
startTime.setDate(startTim
endTime.setTime(startTime.
endTime.setDate(startTime.
}
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.getMo
qtr = qtr - 1;
var year = startTime.getYear() + 1900;
if (qtr <= 0 )
{
qtr = 3;
year = year - 1;
}
startTime.setTime(qtrStart
startTime.setYear(year);
endTime.setTime(qtrEnd[qtr
endTime.setYear(year);
}
else if (range == "This Qtr")
{
var qtr = Math.floor(startTime.getMo
var year = startTime.getYear() + 1900;
startTime.setTime(qtrStart
startTime.setYear(year);
endTime.setTime(qtrEnd[qtr
endTime.setYear(year);
}
else if (range == "Next Qtr")
{
var qtr = Math.floor(startTime.getMo
qtr = qtr + 1;
var year = startTime.getYear() + 1900;
if (qtr >= 3 )
{
qtr = 0;
year = year + 1;
}
startTime.setTime(qtrStart
startTime.setYear(year);
endTime.setTime(qtrEnd[qtr
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.
setSelect(document.myForm.
setSelect(document.myForm.
setSelect(document.myForm.
setSelect(document.myForm.
setSelect(document.myForm.
}
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.
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.
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.
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.
ASKER
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.
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.
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.
ASKER
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/in cludes line 241 HTML Problem
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/in
ASKER
I have removed all the jsp validations in eclipse IDE.
ASKER
The weblogic version is 10gR3. It is actually Oracle Weblogic.
ASKER
Help Please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The error is gone. Real big thanks.
ASKER
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.
ASKER
I would like to ask a question out of curiosity. Why has the .inc file thrown errors.
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.
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.
@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
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
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.
@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
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
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.
There is no problem with compiling jsp files which include files of any extension.
ASKER