You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Session A Mwamufiya <sm...@andrew.cmu.edu> on 2007/08/06 11:32:12 UTC
populating input fields on page load
Hi,
I have a page with input fields, and would like my action to populate those fields before they get displayed. This page is handled by a certain action, but it is the result page from a different action (I click on a button in the previous action form, and this one gets called up). I put some logging in my code, and see that the execute() method never gets called before the page is displayed.
This is what my form looks like:
<s:form action="SMIGCreation" target="SMIGEditor">
<s:textfield name="smigVersion" label="%{getText('smigVersion')}" />
<s:textfield name="smigDesc" label="%{getText('smigDesc')}" />
<s:submit key="saveButton" method="saveButtonPressed" />
</s:form>
Any ideas?
Thanks,
Session
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by Session A Mwamufiya <sm...@andrew.cmu.edu>.
you are right, it now works. Thanks a lot for your help and patience
Best,
Session
> I believe the correct spelling is redirect-action
>
> http://cwiki.apache.org/WW/action-configuration.html
>
> On 8/6/07, Session A Mwamufiya <sm...@andrew.cmu.edu> wrote:
>>
>> I get the following: Caused by: There is no result type defined for type
>> 'redirectAction' mapped with name 'createSMIG' - result -
>> file:/C:/jboss-
>> 4.2.1.GA/server/default/deploy/zen.server.war/WEB-INF/classes/edu/cmu/s
>> ei/smart/zen/server/smigmaintenance/smigmaintenance-config.xml:21:52
>>
>> I'm using struts 2.0.6, is redirectAction not defined for it?
>>
>>> --- Session A Mwamufiya wrote:
>>>> I tried to follow this approach, but my server fails in struts.xml,
>>>> stating that there's an error in building results for my first
>>>> action.
>>>
>>> Does it say anything in particular about the error?
>>>
>>> d.
>>>
>>>
>>>
>>>
>> _______________________________________________________________________
>> __
>>> ___________ Luggage? GPS? Comic books? Check out fitting gifts for
>>> grads
>> at
>>> Yahoo! Search
>>> http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=b
>>> z
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For
>>> additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>>
>> --------------------------------------------------------------------- To
>> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
>> commands, e-mail: user-help@struts.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by Toni Lyytikäinen <to...@gmail.com>.
I believe the correct spelling is redirect-action
http://cwiki.apache.org/WW/action-configuration.html
On 8/6/07, Session A Mwamufiya <sm...@andrew.cmu.edu> wrote:
>
> I get the following:
> Caused by: There is no result type defined for type 'redirectAction'
> mapped with name 'createSMIG' - result - file:/C:/jboss-
> 4.2.1.GA/server/default/deploy/zen.server.war/WEB-INF/classes/edu/cmu/sei/smart/zen/server/smigmaintenance/smigmaintenance-config.xml:21:52
>
> I'm using struts 2.0.6, is redirectAction not defined for it?
>
> > --- Session A Mwamufiya wrote:
> >> I tried to follow this approach, but my server fails in struts.xml,
> >> stating that there's an error in building results for my first action.
> >
> > Does it say anything in particular about the error?
> >
> > d.
> >
> >
> >
> >
> _________________________________________________________________________
> > ___________ Luggage? GPS? Comic books? Check out fitting gifts for grads
> at
> > Yahoo! Search
> > http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
> >
> > --------------------------------------------------------------------- To
> > unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
> > commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: populating input fields on page load
Posted by Dave Newton <ne...@yahoo.com>.
--- Session A Mwamufiya wrote:
> I'm using struts 2.0.6, is redirectAction not
> defined for it?
I don't recall when the result type renaming happened,
but I suspect post-2.0.6 so I'd try redirect-action.
Giving the information about what the error actually
was made it much, much easier to help.
d.
____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by Session A Mwamufiya <sm...@andrew.cmu.edu>.
I get the following:
Caused by: There is no result type defined for type 'redirectAction' mapped with name 'createSMIG' - result - file:/C:/jboss-4.2.1.GA/server/default/deploy/zen.server.war/WEB-INF/classes/edu/cmu/sei/smart/zen/server/smigmaintenance/smigmaintenance-config.xml:21:52
I'm using struts 2.0.6, is redirectAction not defined for it?
> --- Session A Mwamufiya wrote:
>> I tried to follow this approach, but my server fails in struts.xml,
>> stating that there's an error in building results for my first action.
>
> Does it say anything in particular about the error?
>
> d.
>
>
>
> _________________________________________________________________________
> ___________ Luggage? GPS? Comic books? Check out fitting gifts for grads at
> Yahoo! Search
> http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
> commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by Dave Newton <ne...@yahoo.com>.
--- Session A Mwamufiya wrote:
> I tried to follow this approach, but my server fails
> in struts.xml, stating that there's an error in
> building results for my first action.
Does it say anything in particular about the error?
d.
____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by Session A Mwamufiya <sm...@andrew.cmu.edu>.
Hi,
I tried to follow this approach, but my server fails in struts.xml, stating that there's an error in building results for my first action.
Here are my actions:
<action name="SMIGSelection"
class="edu.cmu.sei.smart.zen.server.smigmaintenance.SMIGSelection">
<result name="success">/pages/smigmaintenance/SMIGSelection.jsp</result>
<result name="reloadNavigationFrame">/pages/smigmaintenance/EmptyReloadNavigationTree.jsp</result>
<result name="createSMIG" type="redirectAction">SMIGCreation</result>
</action>
<action name="SMIGCreation"
class="edu.cmu.sei.smart.zen.server.smigmaintenance.SMIGCreation">
<result name="success">/pages/smigmaintenance/SMIGCreation.jsp</result>
<result name="reloadNavigationFrame">/pages/smigmaintenance/EmptyReloadNavigationTree.jsp</result>
</action>
Any ideas why it fails?
Thanks,
Session
>
> You could do redirection after your first action.
>
> myFirstAction.jsp : form + submit buton to MyFirstAction.process()
>
> MyFirstAction { private String myAttribute;
>
> execute() : initialize myAttribute and redirect to "success" =
> myFirstAction.jsp process() : do stuff on myAtrribute submitted in
> myFirstAction.jsp, store it in session, redirect to "second"
>
> getter/setter for myAttribute }
>
> MySecondAction { private String myAttribute;
>
> execute() : initialize myAttribute with what has been store in session
> for exemple, return "success"
>
> getter/setter for myAttribute }
>
> the struts.xml: <action name="goFirst" class="com.myorg.MyFirstAction">
> <result name="success"> /jsp/myFirstAction.jsp </result> <result
> name="second" type="redirectAction"> goSecond </result> </action> <action
> name="goSecond" class="com.myorg.MySecondAction"> <result name="success">
> /jsp/mySecondAction.jsp </result> </action>
>
>
> Session A Mwamufiya wrote:
>>
>> Hi,
>>
>> I have a page with input fields, and would like my action to populate
>> those fields before they get displayed. This page is handled by a
>> certain action, but it is the result page from a different action (I
>> click on a button in the previous action form, and this one gets called
>> up). I put some logging in my code, and see that the execute() method
>> never gets called before the page is displayed.
>>
>> This is what my form looks like: <s:form action="SMIGCreation"
>> target="SMIGEditor"> <s:textfield name="smigVersion"
>> label="%{getText('smigVersion')}" /> <s:textfield name="smigDesc"
>> label="%{getText('smigDesc')}" /> <s:submit key="saveButton"
>> method="saveButtonPressed" /> </s:form>
>>
>> Any ideas?
>>
>> Thanks, Session
>>
>>
>> --------------------------------------------------------------------- To
>> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
>> commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
> -- View this message in context:
> http://www.nabble.com/populating-input-fields-on-page-load-tf4223102.html
> #a12014964 Sent from the Struts - User mailing list archive at Nabble.com.
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
> commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by mleneveut <ML...@abusinessware.com>.
You could do redirection after your first action.
myFirstAction.jsp : form + submit buton to MyFirstAction.process()
MyFirstAction {
private String myAttribute;
execute() : initialize myAttribute and redirect to "success" =
myFirstAction.jsp
process() : do stuff on myAtrribute submitted in myFirstAction.jsp, store
it in session, redirect to "second"
getter/setter for myAttribute
}
MySecondAction {
private String myAttribute;
execute() : initialize myAttribute with what has been store in session for
exemple, return "success"
getter/setter for myAttribute
}
the struts.xml:
<action name="goFirst" class="com.myorg.MyFirstAction">
<result name="success">
/jsp/myFirstAction.jsp
</result>
<result name="second" type="redirectAction">
goSecond
</result>
</action>
<action name="goSecond" class="com.myorg.MySecondAction">
<result name="success">
/jsp/mySecondAction.jsp
</result>
</action>
Session A Mwamufiya wrote:
>
> Hi,
>
> I have a page with input fields, and would like my action to populate
> those fields before they get displayed. This page is handled by a certain
> action, but it is the result page from a different action (I click on a
> button in the previous action form, and this one gets called up). I put
> some logging in my code, and see that the execute() method never gets
> called before the page is displayed.
>
> This is what my form looks like:
> <s:form action="SMIGCreation" target="SMIGEditor">
> <s:textfield name="smigVersion" label="%{getText('smigVersion')}" />
> <s:textfield name="smigDesc" label="%{getText('smigDesc')}" />
> <s:submit key="saveButton" method="saveButtonPressed" />
> </s:form>
>
> Any ideas?
>
> Thanks,
> Session
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/populating-input-fields-on-page-load-tf4223102.html#a12014964
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by Toni Lyytikäinen <to...@gmail.com>.
Does your class implement Preparable interface? Do you have the interceptor
in your interceptor stack? Also, check the syntax of the preparable method -
it should be void like this
public class TestAction extends SomeClass implements Preparable {
...
public void prepare() {
log.debug("This should be called");
}
...
}
http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
On 8/6/07, Session A Mwamufiya <sm...@andrew.cmu.edu> wrote:
>
> Hi, could you give me an actual example, because I added a method called
> Prepare() in my class, but it never gets called. Here's my code:
>
> public String Prepare() {
> log.debug("Populating form fields if a SMIG was selected");
>
> // ...
>
> return SUCCESS;
> }
>
> Nothing gets logged when the form is displayed. Is there something else
> that needs to be setup in the jsp?
>
> Thanks,
> Session
>
>
> > Hi,
> >
> > Implement the prepare method in your action class and add the code in
> that
> > method.
> >
> > Thanks,
> >
> > Nuwan
> >
> >
> > Session A Mwamufiya wrote:
> >> Hi,
> >>
> >> I have a page with input fields, and would like my action to populate
> >> those fields before they get displayed. This page is handled by a
> >> certain action, but it is the result page from a different action (I
> >> click on a button in the previous action form, and this one gets called
> >> up). I put some logging in my code, and see that the execute() method
> >> never gets called before the page is displayed.
> >>
> >> This is what my form looks like: <s:form action="SMIGCreation"
> >> target="SMIGEditor"> <s:textfield name="smigVersion"
> >> label="%{getText('smigVersion')}" /> <s:textfield name="smigDesc"
> >> label="%{getText('smigDesc')}" /> <s:submit key="saveButton"
> >> method="saveButtonPressed" /> </s:form>
> >>
> >> Any ideas?
> >>
> >> Thanks, Session
> >>
> >>
> >> ---------------------------------------------------------------------
> To
> >> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
> >> commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >>
> >
> >
> > --------------------------------------------------------------------- To
> > unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
> > commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: populating input fields on page load
Posted by Session A Mwamufiya <sm...@andrew.cmu.edu>.
Hi, could you give me an actual example, because I added a method called Prepare() in my class, but it never gets called. Here's my code:
public String Prepare() {
log.debug("Populating form fields if a SMIG was selected");
// ...
return SUCCESS;
}
Nothing gets logged when the form is displayed. Is there something else that needs to be setup in the jsp?
Thanks,
Session
> Hi,
>
> Implement the prepare method in your action class and add the code in that
> method.
>
> Thanks,
>
> Nuwan
>
>
> Session A Mwamufiya wrote:
>> Hi,
>>
>> I have a page with input fields, and would like my action to populate
>> those fields before they get displayed. This page is handled by a
>> certain action, but it is the result page from a different action (I
>> click on a button in the previous action form, and this one gets called
>> up). I put some logging in my code, and see that the execute() method
>> never gets called before the page is displayed.
>>
>> This is what my form looks like: <s:form action="SMIGCreation"
>> target="SMIGEditor"> <s:textfield name="smigVersion"
>> label="%{getText('smigVersion')}" /> <s:textfield name="smigDesc"
>> label="%{getText('smigDesc')}" /> <s:submit key="saveButton"
>> method="saveButtonPressed" /> </s:form>
>>
>> Any ideas?
>>
>> Thanks, Session
>>
>>
>> --------------------------------------------------------------------- To
>> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
>> commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional
> commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: populating input fields on page load
Posted by Nuwan Chandrasoma <my...@gmail.com>.
Hi,
Implement the prepare method in your action class and add the code in
that method.
Thanks,
Nuwan
Session A Mwamufiya wrote:
> Hi,
>
> I have a page with input fields, and would like my action to populate those fields before they get displayed. This page is handled by a certain action, but it is the result page from a different action (I click on a button in the previous action form, and this one gets called up). I put some logging in my code, and see that the execute() method never gets called before the page is displayed.
>
> This is what my form looks like:
> <s:form action="SMIGCreation" target="SMIGEditor">
> <s:textfield name="smigVersion" label="%{getText('smigVersion')}" />
> <s:textfield name="smigDesc" label="%{getText('smigDesc')}" />
> <s:submit key="saveButton" method="saveButtonPressed" />
> </s:form>
>
> Any ideas?
>
> Thanks,
> Session
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org