• 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

How to use a link in place of a button

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic