• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

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

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67759
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

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?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
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
What would it mean to run client-side Ajax/JS on the server side?
 
Bear Bibeault
Sheriff
Posts: 67759
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
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 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
solve

 
Lek Kin Wong
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic