This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Best Practice and proper syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Best Practice and proper syntax " Watch "Best Practice and proper syntax " New topic
Author

Best Practice and proper syntax

K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
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?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

I think this would be more appropriate in the JSP forum. So moved.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best Practice and proper syntax