File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts-JSP Application

 
Ramya Thyagarajan
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Milan Jagatiya
Ranch Hand
Posts: 164
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think still you need to give mappings for dwr servlet in web.xml file...append below lines in your web.xml file
 
Ramya Thyagarajan
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thanks
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic