NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to retreive the form's parameters of a JSP through a servlet

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
bardelman



Joined: 01 Apr 2011
Posts: 9

PostPosted: Fri Apr 01, 2011 5:41 pm    Post subject: How to retreive the form's parameters of a JSP through a servlet Reply with quote

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

PostPosted: Sat Apr 02, 2011 12:59 am    Post subject: Re: How to retreive the form's parameters of a JSP through a servlet Reply with quote

Have you tried reading the parameters using the

Back to top
bardelman



Joined: 01 Apr 2011
Posts: 9

PostPosted: Sat Apr 02, 2011 11:49 am    Post subject: Re: How to retreive the form's parameters of a JSP through a servlet Reply with quote

i m sorry for my bad english i just wish i m not misunderstood Smile

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

PostPosted: Mon Apr 04, 2011 1:00 pm    Post subject: Re: How to retreive the form's parameters of a JSP through a servlet Reply with quote

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 Smile

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

PostPosted: Mon Apr 04, 2011 1:20 pm    Post subject: Re: How to retreive the form's parameters of a JSP through a servlet Reply with quote

bardelman wrote:
i m sorry for my bad english i just wish i m not misunderstood Smile

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo