• Post Reply Bookmark Topic Watch Topic
  • New Topic

image verification  RSS feed

 
sujesh Katri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some one please tell which mistake i done below

<%
out.println('<marquee><img src="http://www.allurisitaramaraju.com/alluri.jpg"></img></marquee>');
%>
I want to print html code using jsp syntax but it does not run.If i write same html code using html syntax in jsp it works.I want to hide my data to users.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


and


send the exact same thing to the browser. Putting it in JSP syntax doesn't hide the image URL from the user. It just uses JSP to render the same HTML.

If it isn't sending back the same HTML, I suspect you aren't really calling the JSP. You can check this by viewing source in the browser. If <% is in there, the page isn't running as a JSP.

Also, what URL are you using?
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try

Your html will still be viewable by the user.
 
sujesh Katri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we hide html data in jsp or not..does jsp hide only java date .
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

can we hide html data in jsp or not..does jsp hide only java date .

I do not think that is possible. Unless of course you can use client side scripting to dynamically load the html data elements. Your function could reside in a library that you will keep in your server.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sujesh Katri wrote:can we hide html data in jsp or not..does jsp hide only java date .

You can't perfectly hide HTML data, The JSP will 'hide' the Java part by executing it on the server but the HTML has to be executed on the client - which means the client has to see it. You can make it harder to read by using Javascript. For example you could make the HTML <marquee><img id="toinsert"/></marquee> then write have a javascript file link that gets downloaded and generated by a JSP which then sets the image's src attribute. But a saavy user could still figure out the URL being used (if by nothing else usually by right-clicking on the image and copying the image source path in many browsers).

I guess another approach is to make the image src URL point to a servlet with an identifier parameter. The servlet checks the user's session for the parameter and uses it to read an image and stream the bytes through the response. That way the image is protected from external access and the user doesn't see a direct link to the image, just a link to the servlet and a parameter which would not be viable without proper session consistency.
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,
Concerning your second approach,
what action will make the servlet execute?
Regards.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66152
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browser will send the request when the image is to be displayed.

Remember that to the browser, it's just a URL. It has no idea what's on the other side; servlet or whatever. All it cares is that it sends a request, and gets back a (proper) response.
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, Bear. I love your answers. :-)
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!