• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question on rtexprvalue

 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have a question about rtexprvalue in a custom tag.

For testing, I made this incredible calculator tag, which takes an i and a j and adds them together.
I don't want j to accept EL so I did



and indeed, if I say


I get an exception about my tld that says I can't use expressions etc.
But when I do it like this:


It doesn't complain and takes the EL ?!

any idea why it does this?

thanks!
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

What server are you using?

If I try your example on tomcat 5.5 I get an exception:
org.apache.jasper.JasperException: /jsp/index.jsp(121,27) Expression language not allowed in a template text body.


Regards,
Frits
 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Fritz, thanks for all your answers!

hmm I use apache-tomcat-6.0.29 .. I seem to be getting a lot of strange stuff with my installation

I got the error, changed only the jsp to the jsp:attribute version, and then it worked. Can't see
what I've done wrong...
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post all of your code and your TLD entry?

Maybe we are overlooking something.

Regards,
Frits
 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fritz,

I think I found the cause. Although I don't understand it..

I had the dynamic-attributes on in my tld and in my class.
If it is there, I can use EL in jsp:attribute ,if it's not, I get an exception.





and the tld:



the java file:

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you have found a small error!

According to jsp2.0 specs
Dynamic attributes must be considered to accept request-time expression values.

but that does not mean that all the (tld) declared attributes are suppose to accept rtevalues as well....

Regards,
Frits
 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
woehoe! did I win anything ?

they can ask me this tomorrow on the exam!
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did I win anything ?

Respect

they can ask me this tomorrow on the exam!

Good luck tomorrow! (n.b. have a look at my notes, just for the cramming part, ScwcdLinks, section rancher notes)

Regards,
Frits
 
Mark Uppeteer
Ranch Hand
Posts: 159
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!

I did look at your notes, they are really great! actually the best I could find


just a small error in the notes:

1)There is no <jsp:directive.taglib p7.52
its also in the hfsj book but you got to be careful not to read over it.
2)there is no HAND http method ;) (first page)

Yesterday I took the final hf exam and scored (after errata) 72% ,and I even made some stupid mistakes.
So I'm pretty confident I should pull this one off tomorrow

anyway, you'll hear from me tomorrow around noon!>
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just a small error in the notes:

1)There is no <jsp:directive.taglib p7.52
its also in the hfsj book but you got to be careful not to read over it.
2)there is no HAND http method ;) (first page)

Well spotted!

Thanks, corrected it immediatly and published a new version (how did I ever come up with the method HAND )

Regards,
Frits
 
Ankur Gargg
Ranch Hand
Posts: 55
Java jQuery Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Can you please explain the reason once again for the two different scenarios?

Please help needed.



 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please explain the reason once again for the two different scenarios?

Do you mean why Mark did not get an exception in this case?
That was because he set the dynamic attributes in the TLD file to true, meaning that that tag could take more attributes apart from "i" and "j" (although Marks implementation is not showing a good example of how to implement dynamic attributes, have a look here)

Dynamic attributes will according to the specs accept rtexprvalues, but the attribute "j" has been defined as <rtexprvalue>false</rtexprvalue> and is not one of the dynamic attributes, so an Exception should be thrown by the container. We saw that the exception was thrown in the other case: <calc:add i="5" j="${3+5}" ></calc:add>.

That makes it a small mistake in of Tomcat: it should have thrown an exception in both cases...

Did this answer your question?

Regards,
Frits
 
Ankur Gargg
Ranch Hand
Posts: 55
Java jQuery Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fritz

Can you give me the exact link for your notes?
I am not able to find them anywhere.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ScwcdLinks and then look for the Rancher Notes section.

Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic