aspose file tools*
The moose likes Struts and the fly likes JSP/Struts mapping.findForward problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSP/Struts mapping.findForward problem" Watch "JSP/Struts mapping.findForward problem" New topic
Author

JSP/Struts mapping.findForward problem

MichaelJ McCabe
Ranch Hand

Joined: Feb 09, 2010
Posts: 49
I am having a problem with my web page when trying to forward to another page using mapping.findForward.

I have a form which I want to, when submited, go back to the same page.

This is fine, I define the same page in my config, and call it. It then goes to the page.

The problem I am having, is that it doesnt seem to refresh the page at all. It seems static.

Explination of the webpage:
I have a html:select which is dynamically filled with values from a database. When the user selects one and submits, the value is removed from the database.
Everytime the user visits this page, the values are read from the database, so when I use mapping.findForward to go back to the page, it should refresh? Because it doesnt.

When I chose a second one to remove, the one I removed first is THEN removed, and the one I just removed stays there. Makes me think that because its still selected within the box, it cannot remove it until refreshed. I know that it is doing its job on the database every time, but its not showing it.

I will paste code if needed, but I have a feeling its something small I am missing in how it works.

Thank you in advance guys


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Without any code or config it's impossible to help. Is your forward defined as a redirect?
MichaelJ McCabe
Ranch Hand

Joined: Feb 09, 2010
Posts: 49
Struts config


and the forwarding is done by;


when the page is loaded, i have;


That gets a complete list and passes it to the jsp page for display in the control


So I have a control;


and when submited;




This removes the selected value from the database
MichaelJ McCabe
Ranch Hand

Joined: Feb 09, 2010
Posts: 49
Aplogies for the mixed up variable names. The code is way too big to copy in completely, so iv had to mix and match.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There's no need to define a separate forward, just use mapping.getInputForward() (or whatever it's called; it's been a long time since I've done Struts 1 work).
MichaelJ McCabe
Ranch Hand

Joined: Feb 09, 2010
Posts: 49
David Newton wrote:There's no need to define a separate forward, just use mapping.getInputForward() (or whatever it's called; it's been a long time since I've done Struts 1 work).


Good point. It works just the same, but I agree that is easier so thank you. But it still doesnt solve my problem. It does the same thing.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Make sure caching is turned off. Make sure the value is being removed from the database when you think it is. Make sure you're doing a redirect (not sure if you need to define a forward element in order to do that or not; can't remember).
Ernesto Chicas
Greenhorn

Joined: Jan 13, 2010
Posts: 18

I think your problem is in request.setAttribute ( "usersCompanysList" usersCompanysList);
you do something like: request.setAttribute ( "UserEditForm" UserEditForm), where UserEditForm has a property (String []) containing the list you want to show
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, he's using JSTL to loop over the collection:If you're using a JSP 2+ container a lot of this boilerplate goes away, btw.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP/Struts mapping.findForward problem
 
Similar Threads
Page not refresbing properly
Need Help and Suggestion
Problem i am facing here................
problem of passing parameter
Null Pointer Exception