• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

passing images between the pages in Servlet

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to develop an application on Shopping cart. in that i am getting problem , i am not able to display the image of the purchaged items in the Cart. I am not storing the image in database, i am using the location of image , here in this code <img src="<% out.println("\""+lc+"\""); %>" width="143" height="129" hspace="2" vspace="2" border="0"> . by using "<% out.println("\""+lc+"\""); %>" i tried to give the value to the
src attribute but its not working. in the "CART" attribute image location value is there. or if there is any other method please help me .......... thanks


<%
List list=(List)request.getAttribute("CART");
Iterator it=list.iterator();
while(it.hasNext()){

String lc=it.next().toString();
System.out.println("in showcart.jsp lc="+"\""+lc+"\"");

%>

<tr>
<td><%=lc %></td>

<td>
<form action= "removeFromCart.abhinas">
<input type="hidden" name="imagelocation" value="<%=lc %>"/>
<img src="<% out.println("\""+lc+"\""); %>" width="143" height="129" hspace="2" vspace="2" border="0">
<input type="submit" value="Remove From Cart"/>
</form>
</td>
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This line is pretty much a mess:



What HTML does it generate?

Hint: Look in the browser and do "View Page Source". If you then see that it isn't generating the right contents for that src attribute, then fix your scriptlet to generate the right contents.

I haven't used scriptlets for years because they are totally obsolete, so I don't know if I'm right any more, but if you are stuck with maintaining an old system from years and years ago, ask yourself why <%=lc%> isn't good enough in that position.
 
abhinas raj
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i used already <%=lc%> as the value of src attribute but it not displaying the images.
 
Paul Clapham
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:What HTML does it generate?

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic