Hello,
Well I am a newbie myself but I had a similar problem where I didn't
want to hard code that fact that a particular module required a person
to be logged in or not. Maybe you could make some use of this.
You need to extend the ActionMapping first. To a custom action mapping.
And then define the getter and setter methods which you will later
define in your web.xml file.
Define the variables as protected.
When ur application starts, these values will be loaded. And then from
withing your custom module, which you will useby extending Action class.
You can use your previously defined mapping.
Let me try and explain in the following code.
Define your mapping extension in ur <servlet> tag
<init-param>
<param-name>mapping</param-name>
<param-value>com.vs.mailservermapping</param-value>
</init-param>
My mapping class is a tiny one so here is what it was
public class UserActionMapping extends ActionMapping {
// default case for the login status
protected String srv;
public UserActionMapping() {
super();
}
public void setSrv(String server) {
this.srv = server;
}
public String getSrv() {
return this.srv;
}
}
Then defining the values in the struts-config.xml in any of the action
tags
In your case it would be osmethinglike
<set-property property="mailserver" value="hu.ha.com" />
And then later accessing the value of the server from within you action
code.
UserActionMapping umap = (UserActionMapping)mapping;
String mySrv = umap.getSrv();
mySrv will have the value of the server.
Hope this helps! :) do mail me back if this worked for you.
-----Original Message-----
From: Archana Annamaneni [mailto:[EMAIL PROTECTED]
Sent: Monday, October 20, 2003 10:56 AM
To: [EMAIL PROTECTED]
Subject: Need help in defineing own properties in struts-Urgent
Hi ,
I am doing an application using the struts,in that I have a mail sending
option using the Java Mail.For this i don't want to hard code the SMTP
server name into the application,user should be able to read it from
struts-config.xml or web.xml.
What is the best way to achieve this using the struts.There is really
not much information on the web.
If anyone has any idea please let me know.
Thank you
Archana
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]