Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Struts-config.xml

Thread view: 
dkumar - 14 Sep 2006 14:06 GMT
Hi,
I wanted to pass a parameter with my .do file in struts-config.xml, but
I am not successful in that. I specifically want <action
path="/submit.do?name="smith".........>. Is there a way I can use this
or is this not allowed in struts?
Manish Pandit - 14 Sep 2006 17:05 GMT
What you are trying to do is add request parameters externally.This is
not gonna work unless you have a query string.

I'd recommend using request scoped variables or have the URL on your
JSP carry a query string.

-cheers,
Manish

> Hi,
> I wanted to pass a parameter with my .do file in struts-config.xml, but
> I am not successful in that. I specifically want <action
> path="/submit.do?name="smith".........>. Is there a way I can use this
> or is this not allowed in struts?
Babu Kalakrishnan - 15 Sep 2006 13:59 GMT
> Hi,
> I wanted to pass a parameter with my .do file in struts-config.xml, but
> I am not successful in that. I specifically want <action
> path="/submit.do?name="smith".........>. Is there a way I can use this
> or is this not allowed in struts?

There's a way you can fake it if your application accesses these
parameters only through the ActionForm and not directly from the
request.

Add your custom parameter as the "parameter" attribute of your action
mapping in struts-config.xml. The reset() method of the ActionForm gets
called with the ActionMapping as an argument - so you can access this
value using mapping.getParameter(), and load it to the appropriate
variable in your ActionForm.

Of course you've to be aware that since the reset() method gets called
before the form is populated, if the request does contain a parameter by
 the same name, it will overwrite the value that you had stored there
from within the reset method call.

BK


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.