You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pills <pi...@hmcrecord.ch> on 2007/11/30 12:00:56 UTC
Generating email body with wicket
Hi everybody,
just a little question: is there a way to use wicket to generate the body of
an html email?
I mean, is it possible to output a page in an another place than the
servlet's response outup (like a ByteArrayOutputStream)?
If yes, then I'll be able to put it to my email's body ;)
Thanks
--
View this message in context: http://www.nabble.com/Generating-email-body-with-wicket-tf4902162.html#a14042459
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Generating email body with wicket
Posted by Nazmi ZORLU <na...@srcbilisim.com>.
I solve this one like that (I'm not sure if it is a good way or not) :
My Contact Form's HTML Part:
...
<form wicket:id="contactForm">
<table width="100%">
<tr>
<th colspan="2">Contact Us</th>
</tr>
<tr>
<td>Name </td>
<td><input type="text" wicket:id="name"/></td>
</tr>
...
My InputModel:
...
public final class ContactFormInputModel implements Serializable {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
...
My Email Template Page (HTML) Part
...
<tr>
<th colspan="2" bgcolor="#DFDFDF">New Contact Form
Entry</th>
</tr>
<tr>
<td><b>Name</b></td>
<td><span wicket:id="name"></span></td>
</tr>
...
My Email Template Page (Java) Part
...
public class ContactFormMail extends WebPage {
private ContactFormInputModel model;
public ContactFormMail(ContactFormInputModel model) {
this.model = model;
add(new Label("name", this.model.getName()));
}
public String getSource() {
BufferedWebResponse resp =
(BufferedWebResponse)RequestCycle.get().getResponse();
return resp.toString();
}
...
When I need an HTML source of an email in a form's onSubmit() method:
...
ContactFormMail mailContent = new
ContactFormMail((ContactFormInputModel)getModelObject());
mailContent.render();
String *htmlSource *= mailContent.getSource();
...
I hope this helps!
--
Nazmi ZORLU
Pills wrote:
> Hi everybody,
>
> just a little question: is there a way to use wicket to generate the body of
> an html email?
>
> I mean, is it possible to output a page in an another place than the
> servlet's response outup (like a ByteArrayOutputStream)?
>
> If yes, then I'll be able to put it to my email's body ;)
>
> Thanks
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org