Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to rewrite the url in java web application?  RSS feed

 
Sasha Jain
Greenhorn
Posts: 3
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Form Submit my url changes from

1.localhost:8080/Workflow/admin/GetReports?fname=Form1

to

2.localhost:8080/Workflow/admin/EditReport
Form action is EditReport(Servlet Name).

Now on EditReport i perform the databse operations and forward the request to the GetReports?fname=Formname Servlet using Request Dispatcher.So that i am on the same page which is the first one (1) i started from.

Now Everything works fine on the .jsp page But the url remains unchanged that is the second one (2).

Now if i hit the URL again i.e. localhost:8080/Workflow/admin/EditReport it will give an error.

So how to rewrite the url i.e. from admin/EditReport to /admin/GetReports?fname=Formname after performing all the operations.?
s2.png
[Thumbnail for s2.png]
localhost:8080/Workflow/admin/GetReports?fname=Form1
s1.png
[Thumbnail for s1.png]
localhost:8080/Workflow/admin/EditReport
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try the methods in the response object? (sendRedirect -?)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be following the PRG pattern. See this article.
 
Sasha Jain
Greenhorn
Posts: 3
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Kumarr wrote:Did you try the methods in the response object? (sendRedirect -?)


Thanks it works Now..!!

 
Sasha Jain
Greenhorn
Posts: 3
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You should be following the PRG pattern. See this article.


I was using the same technique/pattern without knowing what it was specifically called..!!

Thank you ..!! The issue is resolved now..!!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!