Get parameters from the URL with JSP

0 votes

In JSP how do I get parameters from the URL?

For example, I have a URL somesite.com/Transaction_List.jsp?accountID=5

Can I use  request.getAttribute( "accountID" ) like there is for sessions or something similar?

May 28, 2018 in Java by sharth
• 3,320 points
388 views

1 answer to this question.

0 votes

To delete the subject record with its subject_id

@RequestMapping(value="subject_setup/delete/{subjectid}",method = RequestMethod.GET)
public ModelAndView delete(@PathVariable int subjectid) {
    subjectsDao.delete(subjectid);
    return new ModelAndView("redirect:/subject_setup");
}

and the parameter will be used for input on your query

public int delete(int subjectid) {
    String sql = "update tbl_subject set isdeleted= '1' where id = "+subjectid+"";
    return template.update(sql);
}
answered May 28, 2018 by parth295
• 4,600 points

Related Questions In Java

0 votes
1 answer

What is the simplest way to read JSON from a URL in java

Read json from url use url.openStream() and read contents ...READ MORE

answered Jun 13, 2018 in Java by samarth295
• 2,190 points
151 views
0 votes
1 answer

How do I get the current date and time using Java?

To print current date and time using ...READ MORE

answered Apr 13, 2018 in Java by Akrati
• 3,150 points
55 views
0 votes
1 answer

How do I create a Java string from the contents of a file?

If you're looking for an alternative that ...READ MORE

answered Apr 19, 2018 in Java by Rishabh
• 3,540 points
73 views
0 votes
2 answers

How can I get the filenames of all files in a folder which may or may not contain duplicates

List<String> results = new ArrayList<String>(); File[] files = ...READ MORE

answered Sep 12, 2018 in Java by Sushmita
• 6,840 points
587 views
0 votes
1 answer

Importing classes in JSP

Use Page Directive to import a Class ...READ MORE

answered May 25, 2018 in Java by Rishabh
• 3,540 points
811 views
0 votes
1 answer

How can we upload the files using JSP/ Servlets in Java?

<form action="upload" method="post" enctype="multipart/form-data"> ...READ MORE

answered Jun 8, 2018 in Java by Sushmita
• 6,840 points
64 views
0 votes
1 answer

Difference between JSF, Servlet and JSP?

Servlet - it's java server side layer. JSP ...READ MORE

answered Jul 2, 2018 in Java by samarth295
• 2,190 points
227 views
0 votes
1 answer

doGet and doPost in Servlets

When you are using HTTP GET requests ...READ MORE

answered Jul 17, 2018 in Java by Mrunal
• 680 points
737 views
0 votes
1 answer

How can I get Key from their respective Values

public class NewClass1 { ...READ MORE

answered May 16, 2018 in Java by parth295
• 4,600 points
30 views
0 votes
2 answers

How to get input from user using System.console()?

Scanner in = new Scanner(System.in); int i = ...READ MORE

answered Aug 2, 2018 in Java by Sushmita
• 6,840 points
38 views