The most intelligent Java IDE
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Application Frameworks » Struts
 
RSS feed
 
New topic
Author

JSP/Struts mapping.findForward problem

MichaelJ McCabe
Greenhorn

Joined: Feb 09, 2010
Messages: 28

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
Bartender

Joined: Sep 29, 2008
Messages: 6873

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

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
MichaelJ McCabe
Greenhorn

Joined: Feb 09, 2010
Messages: 28

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

This message was edited 1 time. Last update was at by MichaelJ McCabe

MichaelJ McCabe
Greenhorn

Joined: Feb 09, 2010
Messages: 28

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
Bartender

Joined: Sep 29, 2008
Messages: 6873

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.

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
David Newton
Author
Bartender

Joined: Sep 29, 2008
Messages: 6873

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).

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
MichaelJ McCabe
Greenhorn

Joined: Feb 09, 2010
Messages: 28

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
Bartender

Joined: Sep 29, 2008
Messages: 6873

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).

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
Ernesto Chicas
Greenhorn

Joined: Jan 13, 2010
Messages: 8

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
Bartender

Joined: Sep 29, 2008
Messages: 6873

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.

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
 
jQuery in Action
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Application Frameworks » Struts
 
RSS feed
 
New topic
The most intelligent Java IDE