Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple scriplet, does this violate model 2?  RSS feed

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I'm getting addicted to EL and JSTL that I don't want to see this kind of style in my page. But does putting these line of codes in my page violate any of the model 2 principles?


 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although, its all about view but its not fabricating the view. I think this code snippet should be in your controller.
 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
If you want to set these headers for a Specific JSP or even for all responses as such , I think using Output filters is a right choice. Correct me if i am wrong.
Code will be much more modular.

Shrinivas
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might try the HTML equivalent:

<meta http-equiv="Cache-Control" content="No-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="No-cache">
<meta http-equiv="Cache-Control" content="no-store">
<meta http-equiv="Cache-Control" content="max-age=0">
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for your reply!


Although, its all about view but its not fabricating the view. I think this code snippet should be in your controller.


I don't have a front-controller for some of my JSP's. Would c:import be sufficient?




Is this cross-browser compatible?




If you want to set these headers for a Specific JSP or even for all responses as such , I think using Output filters is a right choice. Correct me if i am wrong.
Code will be much more modular


I'm not familiar with Output filters... I'll try to google that... Thanks!
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Filters are nothing but just a compliment to servlet. Doing it through filters worth it. For me filters is a kind of must for a java web developer. Its simple and easily digestable.

You said for some of your JSPs you are not using controller. Does it mean those are not following Model2?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Http meta tag you can refer to W3Schools or google it to find browser compatiblity.
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You said for some of your JSPs you are not using controller. Does it mean those are not following Model2?



There are pages that I think will not be needing the help of a controller such as the "About Us" page. Although, I try to create another JSP and include that to my About Page just in case I need to change something. Thank you for your help!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!