• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URGENT!!!!

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, i m developing an application using MVC pattern.
there is one jsp page in which i have next and previous buttons;
my problem is when i hit next button;
i can see my jsp on the address bar!
instead of my servlet(which is must);
can someone tell me wht to pass to the servlet
in order to do the paging!
put wht things into session???
thanx in advance!
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
most likely nothing to do with sessions. Check for the following
is you next button linking to the jsp page rather than the controller ?
are you using Http redirection (typically with the sevdRidect() method) rather than RequestDispatcher while processing the next request?
 
Hrithik Roshan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i m linking my jsp to the controller servlet
and i m using requestDispatcher
thanx for the reply
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use forward() instead of sendRedirect()
 
Hrithik Roshan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well..
i think i have to repeat my question
i knw wht to use to forward my servlet!
my question is
how to pass the request from jsp back to the controller servlet when i m paging;
wht things to put in session??

that is (next and previous)
wht things to put in session??
can someone send me "someCode"
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you click the 'next' button, you see your jsp page in the address bar.

So I'm thinking of ways to produce that result. One way is that you are using links, and your 'next' link is coded as:
<a href="somepage.jsp">Next</a>

That somepage.jsp appears in the address bar should be no surprise, so I'll assume your link is not coded that way.

You are probably using a FORM button. So this button is a submit to your servlet. We are now in your servlet, and also, we know what page is 'next'... How do you use the requestDispatcher() in such a way that your 'next' page appears in the browser's address bar? Answer: use sendRedirect() instead of forward(). Which is why I said use forward() instead.

So is your problem in how to get the servlet to understand what is 'next'??

One way to do this, is to have two hidden fields in the FORM. One called 'previous', one called 'next'. The servlet will use the name of the submit button (you can have more than one submit button for a form, each named differently), plus the hidden fields, to determine what is 'previous' and 'next'.

Nothing need be placed in the session.

p.s. - Asking for 'the code' is a sure way for people NOT to send you 'the code'.
 
Hrithik Roshan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Curwen:
When you click the 'next' button, you see your jsp page in the address bar.

So I'm thinking of ways to produce that result. One way is that you are using links, and your 'next' link is coded as:
<a href="somepage.jsp">Next</a>

That somepage.jsp appears in the address bar should be no surprise, so I'll assume your link is not coded that way.

You are probably using a FORM button. So this button is a submit to your servlet. We are now in your servlet, and also, we know what page is 'next'... How do you use the requestDispatcher() in such a way that your 'next' page appears in the browser's address bar? Answer: use sendRedirect() instead of forward(). Which is why I said use forward() instead.

So is your problem in how to get the servlet to understand what is 'next'??

One way to do this, is to have two hidden fields in the FORM. One called 'previous', one called 'next'. The servlet will use the name of the submit button (you can have more than one submit button for a form, each named differently), plus the hidden fields, to determine what is 'previous' and 'next'.

Nothing need be placed in the session.

p.s. - Asking for 'the code' is a sure way for people NOT to send you 'the code'.


hi, Mike
whoa
(p.s. - Asking for 'the code' is a sure way for people NOT to send you 'the code'.)
well
i send code if i can do it!
i expect the same in RETURN!
nothin NEW!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic