Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7891025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:30:41+00:00 2026-06-03T06:30:41+00:00

// jsp snippet <button name=TesterButton value=TesterButton onClick=location.href=’TesterServlet’;> Servlet Snippet of class TesterServlet writer.println( (String)request.getParameter(TesterButton)

  • 0
// jsp snippet
<button name="TesterButton" value="TesterButton" onClick="location.href='TesterServlet';">

Servlet Snippet of class TesterServlet

writer.println( (String)request.getParameter("TesterButton") ); // always returns null

The above servlet always returns null. Why does it return null ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:30:43+00:00Added an answer on June 3, 2026 at 6:30 am

    It’s working exactly as you told the code to do: changing the window location to the given URL. So, no surprises.

    What you actually want should be coded as follows:

    <form action="TesterServlet">
        <input type="submit" name="TesterButton" value="TesterButton" />
    </form>
    

    Or if you really insist in using JS for this for some reason:

    <button name="TesterButton" value="TesterButton" onclick="location.href='TesterServlet?TesterButton=TesterButton';">
    

    Note that the use of onClick instead of onclick indicates that you’re possibly reading outdated or poor HTML resources/examples.

    See also:

    • HTMLdog – HTML beginner tutorial
    • W3 HTML forms specification
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My JSP contains the following snippet: <c:forEach items=${rulesForm.rules} var=rule varStatus=counter> <tr id=rules${counter.index} name=rules[${counter.index}]> rules
Following is the servlet class that sets the name by invoking a method on
I have this JSP code snippet: <%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c%> <c:choose> <c:when test=${var1.properties[\Item Type\]
Begining with JSP and servlet development, I have some problems with a bodyless custom
In a JSP page, there is such code: <jsp:useBean id=checklog class=com.google.admin.guard.CheckLogBean scope=session /> and
I am using Spring security 3.0.6 . The following JSP snippet is the culprit
I'm trying to use the following snippet inside my tag file: <%@ attribute name=content
I am using spring mvc with Annotations, see the following snippet @RequestMapping(value = /configuration/,
Jsp's are severed in the container as servlet code. I would like to know
How do you remove a cookie in a Java servlet? I tried this: http://www.jguru.com/faq/view.jsp?EID=42225

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.