Results 1 to 6 of 6

Thread: Problem While Passing Parameter To Servlet In JSP

  1. #1
    Join Date
    Jan 2009
    Posts
    65

    Problem While Passing Parameter To Servlet In JSP

    Hello, I am learning Advanced Java and getting problem while using the JSP while passing parameter to the Servlet. I have a jsp page which is showing the list of the images name which are contained in the server. I am making use of the link as below:
    <a href="http://localhost:8050/****/servlet/invert?image.jpg>
    But it is not working. In my servlet it is possible to get the name of the image but my image is not displaying. Can anyone help me?

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Problem While Passing Parameter To Servlet In JSP

    Hey, I am also getting the same problem. When I try to pass a string which is having a parameter of the file gives problem. I am making use of the code below:
    Code:
    <% - One. jsp -%>
    <%
    ParamValue str => see below
    %>
    <jsp:include page="One1.jsp">
    <jsp: param name = "param" value ="<%= paramValue %>"/>
    </ jsp: include>
    
    <% - One2. jsp: -%>
    <% System.out.println (request.getParameter ( "param "));%>
    How can I write the code which will pass the parameter to servlet in JSP?

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Problem While Passing Parameter To Servlet In JSP

    You can solve your problem by making changes in the following way:
    You can pass the image name in the URL:
    Code:
    <a href = "url?picturenameImage => title of link </ a>
    Server side you get the parameter to the query like this:
    Code:
    NomImage String = (String) request.getParameter ( "picture");

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Problem While Passing Parameter To Servlet In JSP

    It may be possible to do it. If you consider the HTML then it can allow you to position a parameter query, after you put the name of the first parameter = value if you want to put a second & then you put the name of the second parameter = value and so on ...
    For example :
    Code:
    <a href ="url? nomPram1 = valeurParam1 & nomPram2 = valeurParam2> title of link </ a>
    Server-side method getParameter () of HttpServletRequest object type allows you to recover any parameter.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Problem While Passing Parameter To Servlet In JSP

    It may possible that by taking reference of the book below you will get the better solution for your problem:
    • Professional JSP 2nd Edition by Simon Brown
    • Beginning JSP Web Development by Jayson Falkner
    • Professional JSP Site Design by Kevin Duffey
    • Professional Java Server Programming J2EE, 1.3 Edition by Ramesh Nagappan
    • Professional Java Servlets 2.3 by Andrew Harbourne-Thomas

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: Problem While Passing Parameter To Servlet In JSP

    It is quiet simple, I think you are having some syntax error and that is why you are getting this problem. So, just make use of the code below for your client and server side program and solve your problem:

    Code:
    <a href ="url? image = nomImage"> title of link </ a>
    Code:
    <a href ="url? nomPram1 = valeurParam1 & nomPram2 = valeurParam2"> title of link </ a>

Similar Threads

  1. Passing object as a parameter in a method
    By Karumbu in forum Software Development
    Replies: 4
    Last Post: 06-01-2011, 01:07 AM
  2. Passing an ArrayList From the Form as Parameter
    By Sheenas in forum Software Development
    Replies: 8
    Last Post: 20-06-2010, 10:45 AM
  3. Passing function parameter and static
    By Banjiji in forum Software Development
    Replies: 3
    Last Post: 27-10-2009, 07:32 PM
  4. Passing parameter of Oracle procedure in PHP
    By Halina in forum Software Development
    Replies: 3
    Last Post: 22-04-2009, 08:46 PM
  5. Parameter passing using NavigateURL
    By Sachit in forum Software Development
    Replies: 3
    Last Post: 26-03-2009, 09:25 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,144,776.05385 seconds with 17 queries