JSP when tag question

View: New views
7 Messages — Rating Filter:   Alert me  

JSP when tag question

by Jim Anderson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



  3   This is a JSP issue. I have unsuccessfully searched for a JSP
  4   support forum so I figured I will start here since the Tomcat
  5   container processes JSP. If this is question is inappropriate,
  6   I apologize. If you can point me to a better forum, please do.

  8   The environment is Tomcat 6.0.18 on Linux using Firefox 2.0.

 I'm writing my first JSP program and I'm having a problem
 with the <c:when> construct. I have a bean that contains
 a property named 'midContent'. When the program segment
 is entered, the bean, BFSInfo, has it's midContent property
 set to 'page2'. The when tag test evaluates to false, yet
 the code within the when tag is executed. Here is the
 code segment:

 18         <c:choose>
 19         <c:when test="${BFSInfo.midContent == 'page1'}">
 20             T/F = ${BFSInfo.midContent == 'page1'}
 21             <br></br>
 22             INFO EL is ${BFSInfo.midContent}
23         </c:when>
 24         ...
 25         </c:choose>


 When run, the lines inside the 'when' construct print the
 following on the web page:

 31     T/F = false
 32     INFO EL is page2
 
 The test expression of line 19 is evaluated again at
 line 20 and the result is 'false' as shown at line 31.
 The output produced by line 22 is shown at
 line 32 and confirms that the value of midContent is 'page2'.
 Can someone explain why the code inside
 the '<c:when>' tag is executed when
 the test on line 19 appears to be evaluating to false?

 Thanks you in advance.

  Jim Anderson


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: JSP when tag question

by Pid-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 3/7/09 13:29, Jim Anderson wrote:

>
>
> 3 This is a JSP issue. I have unsuccessfully searched for a JSP
> 4 support forum so I figured I will start here since the Tomcat
> 5 container processes JSP. If this is question is inappropriate,
> 6 I apologize. If you can point me to a better forum, please do.
>
> 8 The environment is Tomcat 6.0.18 on Linux using Firefox 2.0.
>
> I'm writing my first JSP program and I'm having a problem
> with the <c:when> construct. I have a bean that contains
> a property named 'midContent'. When the program segment
> is entered, the bean, BFSInfo, has it's midContent property
> set to 'page2'. The when tag test evaluates to false, yet
> the code within the when tag is executed. Here is the
> code segment:
>
> 18 <c:choose>
> 19 <c:when test="${BFSInfo.midContent == 'page1'}">
> 20 T/F = ${BFSInfo.midContent == 'page1'}
> 21 <br></br>
> 22 INFO EL is ${BFSInfo.midContent}
> 23 </c:when>
> 24 ...
> 25 </c:choose>
>
>
> When run, the lines inside the 'when' construct print the
> following on the web page:
>
> 31 T/F = false
> 32 INFO EL is page2
>
> The test expression of line 19 is evaluated again at
> line 20 and the result is 'false' as shown at line 31.
> The output produced by line 22 is shown at
> line 32 and confirms that the value of midContent is 'page2'.
> Can someone explain why the code inside
> the '<c:when>' tag is executed when
> the test on line 19 appears to be evaluating to false?

Is the c:choose actually being executed?  Check the HTML source.
What else is in the "choose" block?  No duplication?

p


> Thanks you in advance.
>
> Jim Anderson
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: JSP when tag question

by David Smith-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Following up on what Pid suggested, when you look at the output (view
source in the browser), can you see the <c:choose> and <c:when> tags
still present?  Can you offer us a little more info like what you have
declared for taglibs at the top of this jsp and what's in your webapp's
WEB-INF/lib folder?

--David

Jim Anderson wrote:

>
>
>  3   This is a JSP issue. I have unsuccessfully searched for a JSP
>  4   support forum so I figured I will start here since the Tomcat
>  5   container processes JSP. If this is question is inappropriate,
>  6   I apologize. If you can point me to a better forum, please do.
>
>  8   The environment is Tomcat 6.0.18 on Linux using Firefox 2.0.
>
> I'm writing my first JSP program and I'm having a problem
> with the <c:when> construct. I have a bean that contains
> a property named 'midContent'. When the program segment
> is entered, the bean, BFSInfo, has it's midContent property
> set to 'page2'. The when tag test evaluates to false, yet
> the code within the when tag is executed. Here is the
> code segment:
>
> 18         <c:choose>
> 19         <c:when test="${BFSInfo.midContent == 'page1'}">
> 20             T/F = ${BFSInfo.midContent == 'page1'}
> 21             <br></br>
> 22             INFO EL is ${BFSInfo.midContent}
> 23         </c:when>
> 24         ...
> 25         </c:choose>
>
>
> When run, the lines inside the 'when' construct print the
> following on the web page:
>
> 31     T/F = false
> 32     INFO EL is page2
>
> The test expression of line 19 is evaluated again at
> line 20 and the result is 'false' as shown at line 31.
> The output produced by line 22 is shown at
> line 32 and confirms that the value of midContent is 'page2'.
> Can someone explain why the code inside
> the '<c:when>' tag is executed when
> the test on line 19 appears to be evaluating to false?
>
> Thanks you in advance.
>
>  Jim Anderson
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: JSP when tag question

by Jim Anderson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


David,

Thank you to 'pid' and yourself. I spent quite a few hours
going over the source HTML from Firefox and fixed some
problems (e.g. an tag with no closing tag) and fixed some
inefficient code. I was getting very  inconsistent results
and went through a number of iterations. This was to
follow pid's suggestion.

Then started to respond to your suggestion about the tablib
libraries, etc. I have a number of jsp files using include
statements. Lo and behold, I did not have a taglib directive!
I'm embarrassed to say this, since I know better. I really
thought I had already done it, but I guess at the time I was
going to add the directive, I got distracted and failed to do it.

Having said that, I'm a bit surprised that there was not
error message generate by  tomcat about seeing a reference
to <c:choose> and <c:xxx> with no definition available.

Thanks, again.

Jim


David Smith wrote:

> Following up on what Pid suggested, when you look at the output (view
> source in the browser), can you see the <c:choose> and <c:when> tags
> still present?  Can you offer us a little more info like what you have
> declared for taglibs at the top of this jsp and what's in your webapp's
> WEB-INF/lib folder?
>
> --David
>
> Jim Anderson wrote:
>  
>>  3   This is a JSP issue. I have unsuccessfully searched for a JSP
>>  4   support forum so I figured I will start here since the Tomcat
>>  5   container processes JSP. If this is question is inappropriate,
>>  6   I apologize. If you can point me to a better forum, please do.
>>
>>  8   The environment is Tomcat 6.0.18 on Linux using Firefox 2.0.
>>
>> I'm writing my first JSP program and I'm having a problem
>> with the <c:when> construct. I have a bean that contains
>> a property named 'midContent'. When the program segment
>> is entered, the bean, BFSInfo, has it's midContent property
>> set to 'page2'. The when tag test evaluates to false, yet
>> the code within the when tag is executed. Here is the
>> code segment:
>>
>> 18         <c:choose>
>> 19         <c:when test="${BFSInfo.midContent == 'page1'}">
>> 20             T/F = ${BFSInfo.midContent == 'page1'}
>> 21             <br></br>
>> 22             INFO EL is ${BFSInfo.midContent}
>> 23         </c:when>
>> 24         ...
>> 25         </c:choose>
>>
>>
>> When run, the lines inside the 'when' construct print the
>> following on the web page:
>>
>> 31     T/F = false
>> 32     INFO EL is page2
>>
>> The test expression of line 19 is evaluated again at
>> line 20 and the result is 'false' as shown at line 31.
>> The output produced by line 22 is shown at
>> line 32 and confirms that the value of midContent is 'page2'.
>> Can someone explain why the code inside
>> the '<c:when>' tag is executed when
>> the test on line 19 appears to be evaluating to false?
>>
>> Thanks you in advance.
>>
>>  Jim Anderson
>>
>>
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: JSP when tag question

by Ron McNulty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jim

A liitle OT, but I can recommend the HTML Validator plugin for Firefox (if
you don't already have it). It puts a red light in the bottom right corner
of the browser when you forget an import - the HTML is of course invalid.
Has saved me many a time...

Regards

Ron

----- Original Message -----
From: "Jim Anderson" <ezjab@...>
To: "Tomcat Users List" <users@...>
Sent: Sunday, July 05, 2009 5:52 AM
Subject: Re: JSP when tag question


>
> David,
>
> Thank you to 'pid' and yourself. I spent quite a few hours
> going over the source HTML from Firefox and fixed some
> problems (e.g. an tag with no closing tag) and fixed some
> inefficient code. I was getting very  inconsistent results
> and went through a number of iterations. This was to
> follow pid's suggestion.
>
> Then started to respond to your suggestion about the tablib
> libraries, etc. I have a number of jsp files using include
> statements. Lo and behold, I did not have a taglib directive!
> I'm embarrassed to say this, since I know better. I really
> thought I had already done it, but I guess at the time I was
> going to add the directive, I got distracted and failed to do it.
>
> Having said that, I'm a bit surprised that there was not
> error message generate by  tomcat about seeing a reference
> to <c:choose> and <c:xxx> with no definition available.
>
> Thanks, again.
>
> Jim
>
>
> David Smith wrote:
>> Following up on what Pid suggested, when you look at the output (view
>> source in the browser), can you see the <c:choose> and <c:when> tags
>> still present?  Can you offer us a little more info like what you have
>> declared for taglibs at the top of this jsp and what's in your webapp's
>> WEB-INF/lib folder?
>>
>> --David
>>
>> Jim Anderson wrote:
>>
>>>  3   This is a JSP issue. I have unsuccessfully searched for a JSP
>>>  4   support forum so I figured I will start here since the Tomcat
>>>  5   container processes JSP. If this is question is inappropriate,
>>>  6   I apologize. If you can point me to a better forum, please do.
>>>
>>>  8   The environment is Tomcat 6.0.18 on Linux using Firefox 2.0.
>>>
>>> I'm writing my first JSP program and I'm having a problem
>>> with the <c:when> construct. I have a bean that contains
>>> a property named 'midContent'. When the program segment
>>> is entered, the bean, BFSInfo, has it's midContent property
>>> set to 'page2'. The when tag test evaluates to false, yet
>>> the code within the when tag is executed. Here is the
>>> code segment:
>>>
>>> 18         <c:choose>
>>> 19         <c:when test="${BFSInfo.midContent == 'page1'}">
>>> 20             T/F = ${BFSInfo.midContent == 'page1'}
>>> 21             <br></br>
>>> 22             INFO EL is ${BFSInfo.midContent}
>>> 23         </c:when>
>>> 24         ...
>>> 25         </c:choose>
>>>
>>>
>>> When run, the lines inside the 'when' construct print the
>>> following on the web page:
>>>
>>> 31     T/F = false
>>> 32     INFO EL is page2
>>>
>>> The test expression of line 19 is evaluated again at
>>> line 20 and the result is 'false' as shown at line 31.
>>> The output produced by line 22 is shown at
>>> line 32 and confirms that the value of midContent is 'page2'.
>>> Can someone explain why the code inside
>>> the '<c:when>' tag is executed when
>>> the test on line 19 appears to be evaluating to false?
>>>
>>> Thanks you in advance.
>>>
>>>  Jim Anderson
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: JSP when tag question

by Len Popp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Jul 4, 2009 at 13:52, Jim Anderson<ezjab@...> wrote:
> Having said that, I'm a bit surprised that there was not
> error message generate by  tomcat about seeing a reference
> to <c:choose> and <c:xxx> with no definition available.

I would guess that JSP processor allows unknown tags in case its
output is to be processed by some other software that understands
those tags. JSP can be used to create XML as well as HTML, and it can
be used to create output that isn't a web page.
--
Len

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: JSP when tag question

by Jim Anderson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ron,

Thank you, much! I will definitely get the plugin and give it a
try.

Jim

Ron McNulty wrote:

> Hi Jim
>
> A liitle OT, but I can recommend the HTML Validator plugin for Firefox
> (if you don't already have it). It puts a red light in the bottom
> right corner of the browser when you forget an import - the HTML is of
> course invalid. Has saved me many a time...
>
> Regards
>
> Ron
>
> ----- Original Message ----- From: "Jim Anderson" <ezjab@...>
> To: "Tomcat Users List" <users@...>
> Sent: Sunday, July 05, 2009 5:52 AM
> Subject: Re: JSP when tag question
>
>
>>
>> David,
>>
>> Thank you to 'pid' and yourself. I spent quite a few hours
>> going over the source HTML from Firefox and fixed some
>> problems (e.g. an tag with no closing tag) and fixed some
>> inefficient code. I was getting very  inconsistent results
>> and went through a number of iterations. This was to
>> follow pid's suggestion.
>>
>> Then started to respond to your suggestion about the tablib
>> libraries, etc. I have a number of jsp files using include
>> statements. Lo and behold, I did not have a taglib directive!
>> I'm embarrassed to say this, since I know better. I really
>> thought I had already done it, but I guess at the time I was
>> going to add the directive, I got distracted and failed to do it.
>>
>> Having said that, I'm a bit surprised that there was not
>> error message generate by  tomcat about seeing a reference
>> to <c:choose> and <c:xxx> with no definition available.
>>
>> Thanks, again.
>>
>> Jim
>>
>>
>> David Smith wrote:
>>> Following up on what Pid suggested, when you look at the output (view
>>> source in the browser), can you see the <c:choose> and <c:when> tags
>>> still present?  Can you offer us a little more info like what you have
>>> declared for taglibs at the top of this jsp and what's in your webapp's
>>> WEB-INF/lib folder?
>>>
>>> --David
>>>
>>> Jim Anderson wrote:
>>>
>>>>  3   This is a JSP issue. I have unsuccessfully searched for a JSP
>>>>  4   support forum so I figured I will start here since the Tomcat
>>>>  5   container processes JSP. If this is question is inappropriate,
>>>>  6   I apologize. If you can point me to a better forum, please do.
>>>>
>>>>  8   The environment is Tomcat 6.0.18 on Linux using Firefox 2.0.
>>>>
>>>> I'm writing my first JSP program and I'm having a problem
>>>> with the <c:when> construct. I have a bean that contains
>>>> a property named 'midContent'. When the program segment
>>>> is entered, the bean, BFSInfo, has it's midContent property
>>>> set to 'page2'. The when tag test evaluates to false, yet
>>>> the code within the when tag is executed. Here is the
>>>> code segment:
>>>>
>>>> 18         <c:choose>
>>>> 19         <c:when test="${BFSInfo.midContent == 'page1'}">
>>>> 20             T/F = ${BFSInfo.midContent == 'page1'}
>>>> 21             <br></br>
>>>> 22             INFO EL is ${BFSInfo.midContent}
>>>> 23         </c:when>
>>>> 24         ...
>>>> 25         </c:choose>
>>>>
>>>>
>>>> When run, the lines inside the 'when' construct print the
>>>> following on the web page:
>>>>
>>>> 31     T/F = false
>>>> 32     INFO EL is page2
>>>>
>>>> The test expression of line 19 is evaluated again at
>>>> line 20 and the result is 'false' as shown at line 31.
>>>> The output produced by line 22 is shown at
>>>> line 32 and confirms that the value of midContent is 'page2'.
>>>> Can someone explain why the code inside
>>>> the '<c:when>' tag is executed when
>>>> the test on line 19 appears to be evaluating to false?
>>>>
>>>> Thanks you in advance.
>>>>
>>>>  Jim Anderson
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...