• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

JSP source

 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

My dout is when i host a website that uses jsp, on right click of the mouse buttons will the scriptlets be visible as source code. If yes what should i do to hide that.. Please help..

Thank you in advance..

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While the use of scriptlets is strongly discouraged, what happens when *you* right-click and view source?

Given what you know about JSP pages and how they work what do you think would happen (and why)?
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:While the use of scriptlets is strongly discouraged, what happens when *you* right-click and view source?

Given what you know about JSP pages and how they work what do you think would happen (and why)?




Sorry I am very new to jsps.. Please let me know how to pull out records from DB using JSPs. Or should I create a java class and send all the data via session.

Thanks in advance

:confused:
 
Sheriff
Posts: 67671
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
You don't do DB access in a JSP. As David pointed out, putting Java code in a JSP is no longer acceptable.

Write your DB access code in normal Java classes, and then your controllers can call those classes to obtain the data and send it to the JSP for display.

Since you are new to JSP, I strongly recommend you read the following articles:

this article

this article
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You don't do DB access in a JSP. As David pointed out, putting Java code in a JSP is no longer acceptable.

Write your DB access code in normal Java classes, and then your controllers can call those classes to obtain the data and send it to the JSP for display.

Since you are new to JSP, I strongly recommend you read the following articles:

this article

this article




Thank you
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mahi Lohi wrote:

Bear Bibeault wrote:You don't do DB access in a JSP. As David pointed out, putting Java code in a JSP is no longer acceptable.

Write your DB access code in normal Java classes, and then your controllers can call those classes to obtain the data and send it to the JSP for display.

Since you are new to JSP, I strongly recommend you read the following articles:

this article

this article




Thank you




What is controllers. I use struts.. Can I use sessions to pass the data to the jsps..

And another dout, can I know on technology Javaranch works. If it uses jsps then why isn't .jsp extension found in the url of this page. Since I see http: // localhost:8080/Project_Folder_Name/FileName.jsp. In my browser for the project that I am working on..

Thank you
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't normally see ".jsp" extensions when you use Struts, either--by default the extension is ".do". You could *make* the extension "*.jsp", but that's a little confusing IMO.

Are you asking why there is *no* extension?
 
author & internet detective
Posts: 41250
849
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mahi Lohi wrote:What is controllers. I use struts.. Can I use sessions to pass the data to the jsps..


The Struts controller directs you to the proper action class. And yes, you can use the request or session to pass the data to JSPs.

Mahi Lohi wrote:And another dout, can I know on technology Javaranch works. If it uses jsps then why isn't .jsp extension found in the url of this page. Since I see http: // localhost:8080/Project_Folder_Name/FileName.jsp. In my browser for the project that I am working on..


We use Java. There's no reason the URL is required to give away what technology you use. An advantage to not doing so on a public site is that you can change technologies without changing the URLs people have bookmarked.
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

Mahi Lohi wrote:What is controllers. I use struts.. Can I use sessions to pass the data to the jsps..


The Struts controller directs you to the proper action class. And yes, you can use the request or session to pass the data to JSPs.

Mahi Lohi wrote:And another dout, can I know on technology Javaranch works. If it uses jsps then why isn't .jsp extension found in the url of this page. Since I see http: // localhost:8080/Project_Folder_Name/FileName.jsp. In my browser for the project that I am working on..


We use Java. There's no reason the URL is required to give away what technology you use. An advantage to not doing so on a public site is that you can change technologies without changing the URLs people have bookmarked.



Thank you for your quick responce. And again how do I remove .jsp extension when I host the website..
And Can I put the link of the site once It is hosted for the review on this site. Since it is my first project I require your feedbacks badly... Hope you didn't take me wrongly.

Thank you in advance


 
Bear Bibeault
Sheriff
Posts: 67671
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
For starters, structure your web app correctly so that you are never submitting directly to JSPs. Perhaps this article that I recommended earlier can help.
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:For starters, structure your web app correctly so that you are never submitting directly to JSPs. Perhaps this article that I recommended earlier can help.



The article is great. Thank you for that.

And can I create a automated email sender(ie on this forum i will get a email to my e-id once i get a reply to my query). I wish to include it in the site I am developing. Hope I don't have to use outlook express.

Thank you in advance.

 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:You don't normally see ".jsp" extensions when you use Struts, either--by default the extension is ".do". You could *make* the extension "*.jsp", but that's a little confusing IMO.

Are you asking why there is *no* extension?



Yes, there is no extension for any page url on this forum.. Sorry for the late reply

Thank you in advance
 
On top of spaghetti all covered in cheese, there was this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic