• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use a link in place of a button  RSS feed

 
Fritz Largosa
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Original
--------------------------------------------

<input name="Submit7" type="submit" id="Submit7" value="copy"> Button 1

<%
if(request.getParameter("Submit7") != null){

Do something
}

%>
------------------------------------------

What I want to do
------------------------------------------
I want to do the same thing but instead of a button I use a link instead.

<Link name>

<%
if(Link was clicked){
Do something

}

%>
------------------------------------------
If you know how this can be done, please let me know. I'm clueless. Thanks.
 
Eric Sexton
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your logic have to be inside a Java scriptlet? If not, it sounds like a great candidate for some JavaScript.
 
Fritz Largosa
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started programming and I'm not too comfortable with Javascript. If this can be done using JSP/HTML that would be great, but if it can only be done in Javascript, I wouldn't mind it. I just want the simplist way of doing it. Thanks.
 
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
From your post I see that you are submitting your form to another JSP rather than a servlet. Imho, this is needlessly complicating your life -- having to check whether your form has been submitted or not rather than just assuming that if the servlet has been activated, your form has been submitted. Then you wouldn't need all the client-side goo, you could just submit the form as a result of the link click.

That said, to work with your existing code, place the query string:



on the end of the URL for your link, and your code will detect the presence of the Submit7 parameter.
 
Fritz Largosa
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!