wood burning stoves
The moose likes Struts and the fly likes Struts-JSP Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts-JSP Application" Watch "Struts-JSP Application" New topic

Struts-JSP Application

Ramya Thyagarajan

Joined: Jun 27, 2005
Posts: 15
Hi ,

Iam working on an application with struts architecture and I have JSPs(JSTL) to generate the UI Screens. I have a select option box which retrieves data during "onchange" event. During this the entire page is refreshed. I would Like to implement this request through AJAX/DWR.
Can anyone help me in configuring them with struts.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You start by creating Java classes and methods that do what you want to do and registering them in the dwr.xml file. One thing I have found is that it's better not to use Action classes to interact with DWR. Just write a regular Java class.

Once you've done this, just have your onchange event call the DWR function that's generated to call your server-side Java. You then use the Document Object Model (DOM) and javaScript to make whatever changes to the document you need to make based on the data returned from the DWR function.

If you have specific questions about this process, let us know.

Consultant, Sima Solutions
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
i think still you need to give mappings for dwr servlet in web.xml file...append below lines in your web.xml file

Milan.<br />I can because I think I can...
Ramya Thyagarajan

Joined: Jun 27, 2005
Posts: 15

Thank you for the suggestions. I downloaded th dwr.jar and added to the classpath, also updated dwr.xml for the class to be used. And updated web.xml for dwr mappings.
Also in my JSP included the script and invoked the method.

When I execute my program I get the following exception :

java.lang.UnsupportedClassVersionError: org/directwebremoting/annotations/AnnotationsConfigurator (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code))
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code))
at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:576)
at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at org.directwebremoting.util.LocalUtil.classForName(LocalUtil.java:631)
at org.directwebremoting.impl.ContainerUtil.configureFromAnnotations(ContainerUtil.java:307)
at org.directwebremoting.impl.ContainerUtil.configureContainerFully(ContainerUtil.java:405)
at org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:77)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:262)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1319)
at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:84)
at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:745)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:493)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:379)
at com.ibm.ws.webcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:114)
at com.ibm.ws.webcontainer.VirtualHost.addWebApplication(VirtualHost.java:127)
at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:776)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:729)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:140)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:360)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1019)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1028)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:538)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:724)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:683)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:1678)
at com.ibm.ws.runtime.component.ComponentImpl$_AsynchInitializer.run(ComponentImpl.java:304)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)

Am I getting this due to some version conflict..?
Please help.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You get this error message when all or part of your application is compiled with JDK 1.5, and the server you're running on doesn't support JDK 1.5. This could be either your code or the DWR jar file.

Either upgrade to a server that does support JDK 1.5, or recompile everything for JDK 1.4 compatibility. I'm not sure whether the dwr.jar file requires JDK1.5. If it does, and you can't upgrade to a JDK 1.5 server, I'd suggest you look at getting an earlier version of DWR that is compatible with JDK 1.4.
[ February 06, 2007: Message edited by: Merrill Higginson ]
I agree. Here's the link: http://aspose.com/file-tools
subject: Struts-JSP Application
It's not a secret anymore!