• 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

Best Practice and proper syntax

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently I capture a jsp value in a function such as:


From a best practice standpoint, should I capture this is a variable name or is this acceptable? Secondly, if I wanted to perform an if/else inside this function and on a particular value, do I just wrap the value in an if/else in side the getInfo()? Or, do I create an in-body <script> to run the logic there?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this would be more appropriate in the JSP forum. So moved.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by K Robert:
should I capture this is a variable name or is this acceptable?



I do not understand your question because you're not being very precise. What kind of variable are you talking about? Client-side or server-side?

Secondly, if I wanted to perform an if/else inside this function and on a particular value, do I just wrap the value in an if/else in side the getInfo()? Or, do I create an in-body <script> to run the logic there?



Again, not clear. You wouldn't nest a <script> tag inside another. Are youtalking about a client-side conditional, or a server-side conditional? If the former, just use the JavaScript if statement. Why the confusion?

If it's the mixing of JSP with JavaScript that's confusing you. Just remember that any JSP elements will be evaluated on the server in order to format an HTML page to be sent to the browser. So any part of the page that's not a JSP element gets treated just like any other old-fashioned HTML page.
reply
    Bookmark Topic Watch Topic
  • New Topic