I'm working on a news project for my employer. Currently, the user clicks on a news story that they wish to update, and the update pages loads with a value of NULL for the pageLoaded variable. (Which is fine because it's the first time that the page has loaded.) When the user clicks submit to enter the changes they've made to the story into the database, the pageLoaded changes to 1 indicating that they've already been to the update page. In the Submit link (to upload changes), it's been set up to call the same update page over again. (Hence the PageLoaded variable so I can keep track of where the user is going.)
If the PageLoaded variable is set to 1, I want the page to make changes to the information so that it is acceptable, (Which I've already done), And I then want it to autoForward to another JSP page confirming to the user that the update was successfully uploaded to the database. Now I've already used <JSP:Forward> tags, and they don't seem to work. I get an error message stating that "The URL decoder can't decode /admin/spoke/news"
I've verifyed that this is indeed the correct path to the file that I want to forward to. And the page that I'm forwarding to does exist. But for some reason this error keeps occuring.
We're pleased to have you here with us in the JSP forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
The page you are trying to forward to is a servlet or jsp? Post some code where you get error in order to better understand the problem.
Joined: May 17, 2004
I do apologize, I should explain my situation better. I'm working on a newspaper section, and I'm having a problem with the update_story_news.jsp file. The purpose of this file is to update a story that will appear on the newspaper's website.
What the page is supposed to do, is take the values from all the textboxes and areas, and forward them to the database. On previous projects, we have found that copying/pasting from Microsoft Word would cause some problems when sending to the database. To rectify this, I coded a function that would replace certain problematic characters from word with an HTML equivalent character. For example Double Quotes "" and Single Quotes ''.
This project was originally started with 2 pages. The update page, and the confirmation page which sent back a message to the user letting them know if the update was successfully sent to the database or not. So what I had to do is find a way to incorporate my function in the Update page. (Trying to put the function on the confirmation page only led to further problems.)
So here's what I had in mind. (And correct me if you think my logic is flawed.)
On my update page, (when it loads), I would check a "UPDATE_TYPE" variable to see if this page is loading for the first time (which would mean that the user is updating a story). If this is the case, then the page is to load all the information from the database and display it on the form so the user can make modifications. When the user is finished making the changes and they click on "Submit", The UPDATE_TYPE variable changes to "INSERT" and the Update Page reloads itself. (So I'm calling the same page again)
Except this time when the page loads, I check to see if UPDATE_TYPE is equal to "INSERT". If it is, then I grab all the information from the URL using request.getParameter(), I run my functions to replace any special characters from the copy/paste from Word. And I need to forward all that information (that has just been changed) to the confirmation_news.jsp page. (Which uploads it to the database).
So here's where I'm having a problem. Anytime I try to forward the page I encounter errors. I've tried using
<jsp:forward page="(insert page here)"/></jsp:forward> But for some reason
it refuses to work, and Tomcat kicks out a "Cannot Decode request URL" error. I'm not really sure what this means as I've never seen it before.
But any help you could lend me would be appreciated.
Thanks very much for your speedy responses
Joined: Mar 18, 2004
Are you trying to forward to any servlet or jsp page? Have you done any URL mapping in web.xml for that? and what url you are using to forward?
Joined: May 17, 2004
Thanks for the quick reply,
I'm trying to forward to another JSP page, and I haven't done any URL mapping with web.xml. This project is strictly supposed to be coded in Java, JSP and HTML. I'm trying to forward the information to the following page: