You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mississippi John Hurt <jo...@gmail.com> on 2006/08/21 21:04:04 UTC

RePopulating EditScreen with ActionForm Data

Hi,
What's the best way to do this?
User finished an edit screen, formaction is populated, and info is displayed
on a ReviewInfo page.
User clicks "go-back-edit" goes back to the editscreen, but now data is
gone.

So how should I fix this? Is the best way to put hidden properties for the
form on the review page, thus if user clicks boBackEdit, it will repopulate
the edit screen?  If I put the values in hidden fields, then what if they
have special chars like (<,>,&,etc)? How to escape them so they dont screw
up html, and how to unescape them when read them back (is that necessary)?

Or is it better to, at the edit screen, after user continues, copy
formaction data to a modelbean, put modelbean in session?

Re: RePopulating EditScreen with ActionForm Data

Posted by Bart Busschots <ba...@so-4pt.net>.
Use the struts taglibs and put your form into session scope and you'll 
get the behaviour you want "out of the box".

Bart.


Mississippi John Hurt wrote:
> Hi,
> What's the best way to do this?
> User finished an edit screen, formaction is populated, and info is 
> displayed
> on a ReviewInfo page.
> User clicks "go-back-edit" goes back to the editscreen, but now data is
> gone.
>
> So how should I fix this? Is the best way to put hidden properties for 
> the
> form on the review page, thus if user clicks boBackEdit, it will 
> repopulate
> the edit screen?  If I put the values in hidden fields, then what if they
> have special chars like (<,>,&,etc)? How to escape them so they dont 
> screw
> up html, and how to unescape them when read them back (is that 
> necessary)?
>
> Or is it better to, at the edit screen, after user continues, copy
> formaction data to a modelbean, put modelbean in session?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: RePopulating EditScreen with ActionForm Data

Posted by Puneet Lakhina <pu...@gmail.com>.
On 8/22/06, Mississippi John Hurt <johnhurt@gmail.com > wrote:
>
> Hi,
> What's the best way to do this?
> User finished an edit screen, formaction is populated, and info is
> displayed
> on a ReviewInfo page.
> User clicks "go-back-edit" goes back to the editscreen, but now data is
> gone.
>
> So how should I fix this? Is the best way to put hidden properties for the
> form on the review page, thus if user clicks boBackEdit, it will
> repopulate
> the edit screen?  If I put the values in hidden fields, then what if they
> have special chars like (<,>,&,etc)? How to escape them so they dont screw
> up html, and how to unescape them when read them back (is that necessary)?
>
> Or is it better to, at the edit screen, after user continues, copy
> formaction data to a modelbean, put modelbean in session?
>
> Dont know whats best but this is something that would probably work.
Now assuming you are going to the ReviewInfo page using a forward from the
action to which your page that collects information submits, you could have
something like this in ur ReviewInfo.jsp

<bean:define id="formBean" name="formBean" scope="request" />
<a href="/editScreen.jsp">Go BAck to Edit </a>

and submit this form using the back to edit button. WHat this will
essentially do is copy the bean for the next request, which should then
populate your editScreen.jsp
Try this out, I think it shoudl work.


For escaping your could use this in ur formbean setter methods or the action
class

http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html


Hope this helps

-- 
Puneet