Discussion:
passing request param from struts.xml
Giovanni Azua
2007-09-25 13:03:15 UTC
Permalink
Hi all,

I would like to pass a different request parameter to the same JSP
depending on the Action e.g.

Schedule PERMANENT job => set request parameter to 'permanent' =>
Display ScheduleJobForm JSP
Schedule ONE-TIME job => set request parameter to 'onetime' => Display
ScheduleJobForm JSP

I would like to pass a "frequency" parameter to a jsp that looks like:

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:form action="ScheduleJob.action" method="post" theme="%{currentTheme}">
*<s:hidden name="frequency" value="%{#request.frequency}" />*
<s:submit value="Schedule" align="center"/>
</s:form>

My question is how to place this frequency in the request from the
struts.xml?

I have tried the following but does not work ...

****************************************************************************
struts.xml
****************************************************************************
<action name="OneTimeJobFormDisplay"
class="scheduler.ScheduleJobFormDisplayAction">
<result name="input" type="tiles">
<param name="actionName">webui.oneTimeJobForm</param>
*<param name="frequency">ONETIME</param>*
</result>
</action>

<action name="PermanentJobFormDisplay"
class="scheduler.ScheduleJobFormDisplayAction">
<result name="input" type="tiles">
<param name="actionName">webui.permanentJobForm</param>
*<param name="frequency">PERMANENT</param>*
</result>
</action>
****************************************************************************

TIA,
regards,
Giovanni
Dave Newton
2007-09-25 13:08:23 UTC
Permalink
Post by Giovanni Azua
I would like to pass a different request parameter
to the same JSP depending on the Action
I would like to pass a "frequency" parameter to a
<s:form action="ScheduleJob.action" method="post"
theme="%{currentTheme}">
*<s:hidden name="frequency"
value="%{#request.frequency}" />*
<s:submit value="Schedule" align="center"/>
</s:form>
My question is how to place this frequency in the
request from the struts.xml?
Why does it have to be in the request? If it's a
normal Action property you can access it directly
without using the request; your struts config would
look the same, you'd provide a getter and setter in
the action, and your JSP would refer to it without the
"#request." prefix.

d.

Loading...