• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP source

 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • 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..

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic