This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes Starting server side action without any follwing forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Starting server side action without any follwing forward" Watch "Starting server side action without any follwing forward" New topic
Author

Starting server side action without any follwing forward

Guillaume Jud
Greenhorn

Joined: Mar 23, 2005
Posts: 2
Hy,

I'm using Struts. What I'm trying to do is to send information into a bean from a formulare inside a jsp and launch a server side treatment.
To do that, I have created a formulare in a JSP linked with the struts-config.xml a bean and an java action. Every thing perform as my wishes except that I must define a forward and I don't want to. I don't want any refresh or forward in my view, I just want to launch a server side treatment over sent data.

What should I do? How should I set my action in struts-config.xml and in the java action file?

Please forgive my english,
Thanks for all in advance!
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
"smurf smurf",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we try to strictly enforce. Please re-read this document and edit your display name in order to comply. Thanks in advance, and we look forward to seeing you around the Ranch.

-Moderator Smurf
Guillaume Jud
Greenhorn

Joined: Mar 23, 2005
Posts: 2
Done
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Your Action has to forward somewhere. Why not just send it back to the same view your submitting from? If you really don't want that screen to refresh or change, I suppose you could use the target attribute of <html:form> to specify a new HTML window (you can control the size through javascript), your Action will forward to that new window. Have the forward point to a JSP containing javascript to close the window.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I had to look up what formulare meant. It's French for "application form", no?

Usually, your forward is defined in your Action class. The Action class is part of the Controller, not the View, so this is fine.

In the simplest of cases, the Action will always return "success" as a forward
return mapping.findForward("success");
and it will refer to a forward defined in struts-config. The forward is typically a way for the Controller(which Action is a part of) to decide which View(which is often a jsp or tile) to go to next.


A good workman is known by his tools.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Starting server side action without any follwing forward