If you need the url creation to happen in the tx and you can't
programatically start the tx (say with JTA's UserTransaction API)
before invoking your bean, you'll have to pass your component  or the
RequestCycle (or an adaptor for either) to your spring bean.

Out of curiousity, why would you need to have the actual url creation
in a tx?  Nothing in wicket's urlFor code is going to need a tx or
roll one back if something goes wrong.  If you have some transactional
business logic (say, querying a db) that is creating the params for
the URL you could put that logic in the bean and have it executed in
the tx, and return the params as strings to wicket for encoding in the
URL.

-Clint

-- 
Clint Popetz
http://42lines.net
Scalable Web Application Development



On Wed, May 20, 2009 at 12:10 PM, Kent Larsson <kent.lars...@gmail.com> wrote:
> I have a follow up question, a harder one.
>
> I want to send the mail from a Spring Bean using the Spring Framework.
>
> The Spring Beans mark my transaction boundary. When I call a method in
> a Spring bean a transaction is started, and when the method returns
> the transaction is commited. Inside my Wicket component code there
> never is any transaction.
>
> It would be best if I could create the URL inside the Spring Bean as I
> would like to do it inside the transaction.
>
> I guess I could do it using a callback from the Spring Bean to the
> Wicket component. But if I'm able to do it without any callback I
> think that would be a better solution. Is it possible?
>
> Best regards, Kent
>
>
> On Wed, May 20, 2009 at 6:33 PM, Kent Larsson <kent.lars...@gmail.com> wrote:
>> Thank you, it worked!
>>
>> PageParameters pars = new PageParameters();
>> pars.add("confirmationCode", "some conf?code&string");
>> System.out.println("URL: " + urlFor(ForgotPasswordRequest.class, pars));
>>
>> Best regards, Kent
>>
>>
>> On Wed, May 20, 2009 at 6:01 PM, Clint Popetz <cl...@42lines.net> wrote:
>>> Component.urlFor(ForgotPasswordRequest.class,pars);
>>>
>>> (not a static...call it as "urlFor(...)" from your page or component)
>>>
>>> -Clint
>>>
>>> On Wed, May 20, 2009 at 10:54 AM, Kent Larsson <kent.lars...@gmail.com> 
>>> wrote:
>>>> Hi,
>>>>
>>>> I have created a BookmarkablePageLink and I would like to grab a
>>>> properly escaped URL-string which I can then send through e-mail.
>>>>
>>>> For my first try noHtmlSensitiveChars & fullyEscaped contained the
>>>> empty ("") string:
>>>>
>>>> PageParameters pars = new PageParameters();
>>>> pars.add("confirmationCode", "someconfcodestring");
>>>> BookmarkablePageLink bookmarkablePageLink = new
>>>> BookmarkablePageLink("link", ForgotPasswordRequest.class, pars);
>>>> String noHtmlSensitiveChars = 
>>>> bookmarkablePageLink.getModelObjectAsString();
>>>> String fullyEscaped = Strings.escapeMarkup(noHtmlSensitiveChars, true,
>>>> true).toString();
>>>> System.out.println("No sensitive chars:" + noHtmlSensitiveChars);
>>>> System.out.println("Fully escaped:" + fullyEscaped);
>>>>
>>>> Any ideas on how I could solve this?
>>>>
>>>> Best regards, Kent
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Clint Popetz
>>> http://42lines.net
>>> Scalable Web Application Development
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to