google app engine - Spring-MVC forms on GAE -
i trying create form using spring framework, according (http://groups.google.com/group/google-appengine-java/ browse_thread/thread/d93fd7385bf85bf7), need override initbinder. well, think did , still doesn't work.
my jsp (priceincreasejsp):
<%@ page contenttype="text/html;charset=utf-8" language="java" iselignored="false" session="false" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/ form" %> <form:form method="post" commandname="priceincrease"> increase (%): <form:input path="percentage"/> <input type="submit" value="execute"> </form:form>
myapp-servlet.xml has following:
<bean name="/priceincrease.htm" class="myapp.web.priceincreaseformcontroller"> <property name="sessionform" value="true"/> <property name="commandname" value="priceincrease"/> <property name="commandclass" value="myapp.service.priceincrease"/ > <property name="validator"> <bean class="myapp.service.priceincreasevalidator"/> </property> <property name="formview" value="priceincrease"/> <property name="successview" value="success.htm"/> <property name="productmanager" ref="productmanager" /> </bean>
priceincrease.java:
public class priceincrease implements serializable { private integer percentage; public void setpercentage(integer i) { percentage = i; } public integer getpercentage() { return percentage; } }
priceincreaseformcontroller.java:
public class priceincreaseformcontroller extends simpleformcontroller { private productmanager productmanager; public modelandview onsubmit(object command) throws servletexception { priceincrease priceincrease = (priceincrease) command; integer increase = priceincrease.getpercentage(); productmanager.increaseprice(increase); return new modelandview(new redirectview(getsuccessview())); } public void initbinder(webdatabinder binder, webrequest request) { binder.registercustomeditor(priceincrease.class, new priceincreaseeditor()); binder.registercustomeditor(integer.class, new customnumbereditor(integer.class, true)); // use instead? } public void setproductmanager() {...} public productmanager getproductmanager {...} }
finally, priceincreaseeditor.java: (this wrong..)
public class priceincreaseeditor extends propertyeditorsupport{ @override public void setastext(string text) throws illegalargumentexception { integer increase = new integer(text); super.setvalue(increase); } }
stack trace:
org.springframework.web.servlet.tags.requestcontextawaretag dostarttag: access denied (java.lang.runtimepermission getclassloader) java.security.accesscontrolexception: access denied (java.lang.runtimepermission getclassloader) @ java.security.accesscontrolcontext.checkpermission(accesscontrolcontext.java: 355) @ java.security.accesscontroller.checkpermission(accesscontroller.java: 567) @ java.lang.securitymanager.checkpermission(securitymanager.java: 549) @ com.google.apphosting.runtime.security.customsecuritymanager.checkpermission(customsecuritymanager.java: 45) @ java.lang.classloader.getsystemclassloader(classloader.java:1311) @ org.springframework.beans.beanutils.findeditorbyconvention(beanutils.java: 368) @ org.springframework.validation.abstractpropertybindingresult.getcustomeditor(abstractpropertybindingresult.java: 110) @ org.springframework.validation.abstractpropertybindingresult.formatfieldvalue(abstractpropertybindingresult.java: 87) @ org.springframework.validation.abstractbindingresult.getfieldvalue(abstractbindingresult.java: 230) @ org.springframework.web.servlet.support.bindstatus.<init>(bindstatus.java: 120) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.getbindstatus(abstractdataboundformelementtag.java: 172) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.getpropertypath(abstractdataboundformelementtag.java: 192) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.getname(abstractdataboundformelementtag.java: 158) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.autogenerateid(abstractdataboundformelementtag.java: 145) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.resolveid(abstractdataboundformelementtag.java: 136) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.writedefaultattributes(abstractdataboundformelementtag.java: 120) @ org.springframework.web.servlet.tags.form.abstracthtmlelementtag.writedefaultattributes(abstracthtmlelementtag.java: 379) @ org.springframework.web.servlet.tags.form.inputtag.writetagcontent(inputtag.java: 139) @ org.springframework.web.servlet.tags.form.abstractformtag.dostarttaginternal(abstractformtag.java: 90) @ org.springframework.web.servlet.tags.requestcontextawaretag.dostarttag(requestcontextawaretag.java: 77) @ org.apache.jsp.web_002dinf.jsp.priceincrease_jsp._jspx_meth_form_005finput_005f0(priceincrease_jsp.java: 149) @ org.apache.jsp.web_002dinf.jsp.priceincrease_jsp._jspservice(priceincrease_jsp.java: 82) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:97) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.mortbay.jetty.servlet.servletholder.handle(servletholder.java: 511) @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java: 390) @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java: 216) @ org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java: 182) @ org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java: 765) @ org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java: 418) @ org.mortbay.jetty.servlet.dispatcher.forward(dispatcher.java:327) @ org.mortbay.jetty.servlet.dispatcher.forward(dispatcher.java:126) @ org.springframework.web.servlet.view.internalresourceview.rendermergedoutputmodel(internalresourceview.java: 240) @ org.springframework.web.servlet.view.abstractview.render(abstractview.java: 258) @ org.springframework.web.servlet.dispatcherservlet.render(dispatcherservlet.java: 1174) @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java: 901) @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java: 809) @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java: 571) @ org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java: 501) @ javax.servlet.http.httpservlet.service(httpservlet.java:617) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.mortbay.jetty.servlet.servletholder.handle(servletholder.java: 511) @ org.mortbay.jetty.servlet.servlethandler $cachedchain.dofilter(servlethandler.java:1166) @ com.google.apphosting.utils.servlet.parseblobuploadfilter.dofilter(parseblobuploadfilter.java: 97) @ org.mortbay.jetty.servlet.servlethandler $cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.runtime.jetty.savesessionfilter.dofilter(savesessionfilter.java: 35) @ org.mortbay.jetty.servlet.servlethandler $cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.utils.servlet.transactioncleanupfilter.dofilter(transactioncleanupfilter.java: 43) @ org.mortbay.jetty.servlet.servlethandler $cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java: 388) @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java: 216) @ org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java: 182) @ org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java: 765) @ org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java: 418) @ com.google.apphosting.runtime.jetty.appversionhandlermap.handle(appversionhandlermap.java: 238) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java: 152) @ org.mortbay.jetty.server.handle(server.java:326) @ org.mortbay.jetty.httpconnection.handlerequest(httpconnection.java: 542) @ org.mortbay.jetty.httpconnection $requesthandler.headercomplete(httpconnection.java:923) @ com.google.apphosting.runtime.jetty.rpcrequestparser.parseavailable(rpcrequestparser.java: 76) @ org.mortbay.jetty.httpconnection.handle(httpconnection.java:404) @ com.google.apphosting.runtime.jetty.jettyservletengineadapter.servicerequest(jettyservletengineadapter.java: 135) @ com.google.apphosting.runtime.javaruntime.handlerequest(javaruntime.java: 261) @ com.google.apphosting.base.runtimepb$evaluationruntime $6.handleblockingrequest(runtimepb.java:8495) @ com.google.apphosting.base.runtimepb$evaluationruntime $6.handleblockingrequest(runtimepb.java:8493) @ com.google.net.rpc.impl.blockingapplicationhandler.handlerequest(blockingapplicationhandler.java: 24) @ com.google.net.rpc.impl.rpcutil.runrpcinapplication(rpcutil.java: 435) @ com.google.net.rpc.impl.server$rpctask.runincontext(server.java: 572) @ com.google.tracing.tracecontext$tracecontextrunnable $1.run(tracecontext.java:448) @ com.google.tracing.tracecontext.runincontext(tracecontext.java: 688) @ com.google.tracing.tracecontext $abstracttracecontextcallback.runininheritedcontextnounref(tracecontext.java: 326) @ com.google.tracing.tracecontext $abstracttracecontextcallback.runininheritedcontext(tracecontext.java: 318) @ com.google.tracing.tracecontext $tracecontextrunnable.run(tracecontext.java:446) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java: 1110) @ java.util.concurrent.threadpoolexecutor $worker.run(threadpoolexecutor.java:603) @ java.lang.thread.run(thread.java:636)
i've been pretty stuck while now... ideas?
simpleformcontroller.initbinder()
takes (httpservletrequest request, servletrequestdatabinder binder)
while initbinder()
takes arguments in opposite order.
so haven't overridden it. try switching order of arguments. , whenever intend override anything, put @override
on compiler can catch mistakes 1 you.
Comments
Post a Comment