• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is their any wrong in my JSP structure?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I developed a webapp using JSP but i didn't used JSTL tags much and i didn't used beens also.
Everything i written like
<%@//some pakages%>
<%
//database connection

//if and for loops

%>
<html>

<%

//for loops
%>
</html>
is their any problem writing whole jsp code in this manner


 
manohar gunturu
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry to mention even my jsp page contains javascript also
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it is considered bad design to keep any Java code in a JSP. That's what servlets and backing beans are for.

There's nothing wrong with keeping JavaScript code in a JSP, but if it's a lot you should consider moving that into its own file that the HTML can then load.
 
manohar gunturu
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why it is considered as bad design is their any security restrictions..
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's got nothing to do with security, it's just bad design. These days (for the last 10 years, actually), separation of concerns has taken hold in software design. For web apps, that means using MVC, amongst others. See https://coderanch.com/how-to/java/Model1Model2MVC and http://www.javaranch.com/journal/200603/Journal200603.jsp#a5 for more information.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic