NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
bardelman
Joined: 01 Apr 2011 Posts: 9
|
Posted: Fri Apr 01, 2011 5:41 pm Post subject: How to retreive the form's parameters of a JSP through a servlet |
|
|
Hello,
Since a JSP that is located under the WEB-INF directory of my project I would like to insert data into my DB with a source reference (declared
with <resource-ref> in web.xml .. ) And JSTL sql tags: update
dataSource = "...
j I try this same method in my index.jsp and it works
perfectly: The trick was to put in my fields of action
of the form the URL of that same page ie action = "index.jsp" in order to
read data entered on the form and than persist them..
The problem with the JSP under WEB-INF is that access to the JSP
is exclusively through a servlet .. so if I put it in action: @
the same JSP it does not work and if I put the URL of
the servlet which will redispatch to my page the data is lost
Halfway ...
help please! |
|
| Back to top |
|
 |
jyeary
Joined: 21 Oct 2008 Posts: 605 Location: Simpsonville, SC
|
Posted: Sat Apr 02, 2011 12:59 am Post subject: Re: How to retreive the form's parameters of a JSP through a servlet |
|
|
Have you tried reading the parameters using the
|
|
| Back to top |
|
 |
bardelman
Joined: 01 Apr 2011 Posts: 9
|
Posted: Sat Apr 02, 2011 11:49 am Post subject: Re: How to retreive the form's parameters of a JSP through a servlet |
|
|
i m sorry for my bad english i just wish i m not misunderstood
in other words my question is" How a servlet can dispatch a respnse with the same parametres given in the received request " |
|
| Back to top |
|
 |
jyeary
Joined: 21 Oct 2008 Posts: 605 Location: Simpsonville, SC
|
Posted: Mon Apr 04, 2011 1:00 pm Post subject: Re: How to retreive the form's parameters of a JSP through a servlet |
|
|
I am not sure what you are trying to get at, but you can read the Request (HttpRequest) and do what ever you would like, and return a response of your own choosing. If you need to modify the request, or response you also use filters, or HttpServletRequestWrapper/HttpServletResponseWrapper to modify them.
On Sat, Apr 2, 2011 at 7:50 AM, bardelman <address-removed ([email]address-removed[/email])> wrote:
| Quote: | i m sorry for my bad english i just wish i m not misunderstood
in other words my question is" How a servlet can dispatch a respnse with the same parametres given in the received |
|
| Back to top |
|
 |
malm
Joined: 19 Mar 2010 Posts: 25
|
Posted: Mon Apr 04, 2011 1:20 pm Post subject: Re: How to retreive the form's parameters of a JSP through a servlet |
|
|
| bardelman wrote: | i m sorry for my bad english i just wish i m not misunderstood
in other words my question is" How a servlet can dispatch a respnse with the same parametres given in the received request " |
In your servlet simply forward to the JSP page in question like:
| Code: | | request.getRequestDispatcher("/WEB-INF/jsp/myspecial.jsp").forward(request, response); |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|