• 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

JSP/Struts mapping.findForward problem

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without any code or config it's impossible to help. Is your forward defined as a redirect?
 
MichaelJ McCabe
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Greenhorn
Posts: 18
jQuery Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic