Prev | Current Page 211 | Next

Frank Zammetti

"Practical DWR 2 Projects"

lang.StackTraceElement" converter="bean" />
As with any time you decide to dump a stack trace, realize that it can be rather long and
verbose, so it??™s definitely something you want to use with caution.
Help from Elsewhere: Accessing Other URLs
Let??™s say you have a class that you are calling via DWR, and in this class you need the services
of another part of the application. However, this part of the application isn??™t exposed via DWR.
For instance, you need to show a particular entry form to the user, so all you really want to do
is insert some markup into a
on the page. However, the form is created dynamically
using Velocity templates. You may think DWR can??™t really help you here, but in fact it can.
DWR gives you the ability to fetch content from a URL and return it as the result of a
method execution. For instance, examine the class in Listing 3-3.
Listing 3-3. Reading from Another URL and Returning the Result
package app;
import java.io.IOException;
import javax.servlet.ServletException;
import org.directwebremoting.WebContextFactory;
CHAPTER 3 n ADVANCED DWR 107
/**
* A class to read from a URL and return the contents.
*/
public class URLReader {
/**
* Read a URL and return its contents.


Pages:
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223