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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to