|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
How to accress property set to action elementI want to access property that i set in action element.
Here is the action element in strust-config file. <action-mappings type="org.apache.struts.action.ActionMapping"> <action path="/login" name="loginForm" type="com.myapp.web.struts.LoginAction" input="/login.jsp" scope="request"> <set-property property="authenticat" value="true"/> <forward name="init" path="/loginjsp.do" /> <forward name="success" path="/welcome.do" /> <forward name="failure" path="/loginjsp.do" /> </action> How can i access 'authenticated' property element autheticated in action call process() method. Is there any method in ActionMapping class that will help to get this property. Observation: ------------------ After setting this property i tryed to run my webapplication. But which gives me an error. Nitin mandolkar. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: How to accress property set to action elementnitin mandolkar wrote:
> I want to access property that i set in action element. > > Here is the action element in strust-config file. > > <action-mappings type="org.apache.struts.action.ActionMapping"> > <action > path="/login" > name="loginForm" > type="com.myapp.web.struts.LoginAction" > input="/login.jsp" > scope="request"> > <set-property property="authenticat" value="true"/> > <forward name="init" path="/loginjsp.do" /> > <forward name="success" path="/welcome.do" /> > <forward name="failure" path="/loginjsp.do" /> > </action> > > How can i access 'authenticated' property element autheticated in > action call process() method. Is there any method in ActionMapping > class that will help to get this property. > > Observation: > ------------------ > After setting this property i tryed to run my webapplication. But > which gives me an error. That's not really much of an observation. Maybe you have a typo? -Dave --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: How to accress property set to action elementnitin mandolkar wrote:
> I want to access property that i set in action element. > > Here is the action element in strust-config file. > > <action-mappings type="org.apache.struts.action.ActionMapping"> > <action > path="/login" > name="loginForm" > type="com.myapp.web.struts.LoginAction" > input="/login.jsp" > scope="request"> > <set-property property="authenticat" value="true"/> > <forward name="init" path="/loginjsp.do" /> > <forward name="success" path="/welcome.do" /> > <forward name="failure" path="/loginjsp.do" /> > </action> > > How can i access 'authenticated' property element autheticated in > action call process() method. Is there any method in ActionMapping > class that will help to get this property. No, you have to supply the relevant methods yourself. From the documentation in struts-config.dtd: <!-- The "set-property" element specifies the method name and initial value of an additional JavaBean configuration property. When the object representing the surrounding element is instantiated, the accessor for the indicated property is called and passed the indicated value. The "set-property" element is especially useful when a custom subclass is used with <forward>, <action>, or <plug-in> elements. The subclass can be passed whatever other properties may be required to configure the object without changing how the struts-config is parsed. Since Struts 1.3, an alternate syntax is supported. By using the "key" attribute instead of the "property" attribute, you can set arbitrary string properties on the Config object which is populated based on the containing element. NOTE: the "key" attribute is NOT supported for <set-property> inside a <plug-in> element. property Name of the JavaBeans property whose setter method will be called. Exactly one of "property" or "key" must be specified. key Where supported, the key which will be used to store the specified value in the given config object. Exactly one of "property" or "key" must be specified. value String representation of the value to which this property will be set, after suitable type conversion --> So you need to add String getAuthenticated() / void setAuthenticated(String) methods to your action class. > Observation: > ------------------ > After setting this property i tryed to run my webapplication. But > which gives me an error. > > Nitin mandolkar. Can't offer much help with that unless you post the error you got... L. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |