Link does not send parameters and redirects to Servlet

Asked

Viewed 54 times

5

I put on my index page where I have three links one with T-shirts, Bermuda and Pants on href I put so that when clicked on the link it was redirected to Servlet and sent the parameters according to the link, but this does not happen.

Page JSP

<%
  String camisetas="Camisetas";
  String bermudas="Bermudas";
  String calcas="Calças";
%>

<div class="dropdown-content3">

 <li><a href="ListarProdutosPaginada?tipo=${camisetas}">Camisetas</a></li>
 <li><a href="ListarProdutosPaginada?tipo=${bermudas}"> Bermudas</a></li>
 <li><a href="ListarProdutosPaginada?tipo=${calcas}">Calças</a></li>
                      

</div>

1 answer

1


Your urls are incomplete. It would have to be something like this:

<li>
 <a href="http://localhost:8080/app/ListarProdutosPaginada?tipo=${camisetas}">Camisetas</a>
</li>

Instead of 'app' put the context you’re using into your app. If you’re not using one, leave without.

  • romarcio now it is redirected to Servlet, but it does not send the parameter looks like https when I click on the link http:/localhost:8080/Eccomercejsp2/List Productutospaginada? guy=

  • Then the parameter ${camisetas} should be empty. If you are recovering this value from the variables you declared on the page as String, then you should use: ?tipo=<%= camisetas %>

  • was that right vlw

Browser other questions tagged

You are not signed in. Login or sign up in order to post.