receive POST in a jps

S

Sigi

Hi,
is it possible in a JSP to receive data sent thru POST to that JSP? (without
using a servlet)

I tried with
request.getAttribute("parameter")
but it doesn't work.

Thanks
 
A

Alex Hunsley

Sigi said:
Hi,
is it possible in a JSP to receive data sent thru POST to that JSP? (without
using a servlet)

What the other guy said...

I just want to add the detail that JSPs actually work by getting
compiled to servlets behind the scenes. But yes, without explicitly
writing a servlet, a JSP page can access the POST data.
 
D

Daniel Pitts

Hi,
is it possible in a JSP to receive data sent thru POST to that JSP? (without
using a servlet)

I tried with
request.getAttribute("parameter")
but it doesn't work.

Thanks

${param.parameter}

For instance. POSTing the value 'Bob' paramter named whodunnit to the
url 'http://myhost.com/index.jsp' which contains '${param.whodunnit}
did it' will product the output 'Bob did it'

Although, its good practice to leave JSPs to doing what they do best,
rendering from a template. You would be better to do all of your
business login in a Servlet request (Controller), and then pass the
results (Model) to your JSP (View). Struts Tiles is a good utility for
this. As well as the Spring Framework and Spring MVC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top