aspose file tools*
The moose likes JSP and the fly likes JSP source Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP source" Watch "JSP source" New topic
Author

JSP source

Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jun 22, 2009
Posts: 150
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

Joined: Jan 10, 2002
Posts: 60071
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
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

Joined: Jun 22, 2009
Posts: 150
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

Joined: Sep 29, 2008
Posts: 12617

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29275
    
140

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
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

Joined: Jan 10, 2002
Posts: 60071
    
  65

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

Joined: Jun 22, 2009
Posts: 150
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

Joined: Jun 22, 2009
Posts: 150
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP source
 
Similar Threads
java.lang.IllegalArgument Exception: No bean specified
Why Is Tomcat 4 Doing This?
New To JSP
Old JSP page is suddenly incomplete
How to make a jar file of web application