Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I hide a Ajax/JS in a JSP, pr can I run a Ajax/JS code in server side?  RSS feed

 
Lek Kin Wong
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a simple form in my JSP, which I dont want it to refresh the page when I click submit, so I submit the form in background by Ajax.
however, the code of Ajax/JS is easy to find by following the src in the source code of JSP.
Can I hide a Ajax/JS in a JSP, or can I run a Ajax/JS code in server side?
thank you all.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lek Kin Wong wrote:however, the code of Ajax/JS is easy to find by following the src in the source code of JSP.

So?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything you do on the client side - JS, CSS, HTML, whatever, is always going to be visible to the client side with the right tools.

If you want to hide algorithms, etc etc. do all your processing on the server side and just send plain HTML in responses. Naturally this will be slower. Making a "Rich Internet Application" just naturally exposes what you are doing on the client side.

Bill
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would it mean to run client-side Ajax/JS on the server side?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still wondering why this is viewed to be a problem.
 
Lek Kin Wong
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:I'm still wondering why this is viewed to be a problem.

first things first, thanks.
because I dont want the people can submit a form by just typing a address in url bar, that why viewed is a problem.
and i know that php can do this so im just wonder could jsp can do the same thing as below:
http://www.developertutorials.com/tutorials/php/hide-your-javascript-with-php-050419-1254/
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could do the exact same thing.

But it won't do anything like you're asking: even if I don't try to load the page containing the JS it's *still* in my browser and I can just look at it from the original page.

And *any* request you make from the browser can be made manually.
 
Lek Kin Wong
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
solve

 
Lek Kin Wong
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lek Kin Wong wrote:by the way, i also have another question,
i just install tomcat7.0.2 in ubuntu10, but i found Ajax cannot read a file, also the layout of the web is different from Windows...

i want to put a "*" and the text input in the same line, here is the code which work in Windows but not Ubuntu...

.html file


.css file
 
Lek Kin Wong
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:You could do the exact same thing.

But it won't do anything like you're asking: even if I don't try to load the page containing the JS it's *still* in my browser and I can just look at it from the original page.

And *any* request you make from the browser can be made manually.

oops, I see and many thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!