判断strtus的struts2 index.jsp值当大于多少时展开

REST Plugin
&&&&&&&&&&
REST Plugin
2.1.1.1 2.1.1.2
3.1 3.2 3.3
OverviewThe REST Pluginprovides high level support for the implementation of RESTful resource based web applicationsThe REST plugin can cooperate with the
to support a zero configuration approach to declaring your actions and results, but you can always use the REST plugin with XML style configuration if you like.If you prefer to see a working code example, instead of reading through an explanation, you can download the
and check out the struts2-rest-showcase application, a complete WAR file, that demonstrates a simple REST web program.FeaturesRuby on Rails REST-style URLsZero XML config when used with Convention PluginBuilt-in serialization and deserialization support for XML and JSONAutomatic error handlingType-safe configuration of the HTTP responseAutomatic conditional GET supportMapping REST URLs to Struts 2 ActionsThe main functionality of the REST plugin lies in the interpretation of incoming request URL's according the RESTful rules. In the Struts 2 framework, this 'mapping' of request URL's to Actions is handled by in implementation of the
interface. Out of the box, Struts 2 uses the
to map URL's to Actions via the logic you are probably already familiar with.
The REST plugin provides an alternative implementation, , that provides the RESTful logic that maps a URL to a give action class ( aka 'controller' in RESTful terms ) and, more specifically, to the invocation of a method on that controller class. The following section, which comes from the Javadoc for the class, details this logic.RESTful URL Mapping LogicThis Restful action mapper enforces Ruby-On-Rails REST-style mappings. If the method is not specified (via '!' or 'method:' prefix), the method is "guessed" at using REST-style conventions that examine the URL and the HTTP method. Special care has been given to ensure this mapper works correctly with the codebehind plugin so that XML configuration is unnecessary.This mapper supports the following parameters:struts.mapper.idParameterName - If set, this value will be the name of the parameter under which the id is stored. The id will then be removed from the action name. Whether or not the method is specified, the mapper will  try to truncate the identifier from the url and store it as a parameter.struts.mapper.indexMethodName - The method name to call for a GET request with no id parameter. Defaults to index.struts.mapper.getMethodName - The method name to call for a GET request with an id parameter. Defaults to show.struts.mapper.postMethodName - The method name to call for a POST request with no id parameter. Defaults to create.struts.mapper.putMethodName - The method name to call for a PUT request with an id parameter. Defaults to update.struts.mapper.deleteMethodName - The method name to call for a DELETE request with an id parameter. Defaults to destroy.struts.mapper.editMethodName - The method name to call for a GET request with an id parameter and the edit view specified. Defaults to edit.struts.mapper.newMethodName - The method name to call for a GET request with no id parameter and the new view specified. Defaults to editNew.The following URL's will invoke its methods:GET: /movies =& method=indexGET: /movies/Thrillers =& method=show, id=ThrillersGET: /movies/Tedit =& method=edit, id=ThrillersGET: /movies/Thrillers/edit =& method=edit, id=ThrillersGET: /movies/new =& method=editNewPOST: /movies =& method=createPUT: /movies/Thrillers =& method=update, id=ThrillersDELETE: /movies/Thrillers =& method=destroy, id=Thrillers
Or, expressed as a table:HTTP methodURIClass.methodparametersGET/movieMovie.index POST/movieMovie.create PUT/movie/ThrillersMovie.updateid="Thrillers"DELETE/movie/ThrillersMovie.destroyid="Thrillers"GET/movie/ThrillersMovie.showid="Thrillers"GET/movie/Thrillers/editMovie.editid="Thrillers"GET/movie/newMovie.editNew Content TypesIn addition to providing mapping of RESTful URL's to Controller ( Action ) invocations, the REST plugin also provides the ability to produce multiple representations of the resource data. By default, the plugin can return the resource in the following content types:HTMLXML JSONThere is nothing configure here, just add the conent type extension to your RESTful URL. The framework will take care of the rest. So, for instance, assuming a Controller called Movies and a movie with the id of superman, the following URL's will all hit the
UsageThis section will walk you through a quick demo. Here are the steps in the sequence that we will follow.Setting Up your ProjectConfiguring your ProjectWriting your ControllersSetting UpAssuming you have a normal Struts 2 application, all you need to do for this REST demo is to add the following two plugins:Struts 2 Rest PluginNote, you can download the jars for these plugins from Configuration ( struts.xml )Just dropping the plugin's into your application may not produce exactly the desired effect. There are a couple of considerations. The first consideration is whether you want to have any non-RESTful URL's coexisting with your RESTful URL's. We'll show two configurations. The first assumes all you want to do is REST. The second assumes you want to keep other non-RESTful URL's alive in the same Struts 2 application.
REST Only ConfigurationInstruct Struts to use the REST action mapper:
At this point, the REST mapper has replaced the DefaultActionMapper so all incoming URL's will be interpreted as RESTful URL's.We're relying on the Convention plugin to find our controllers, so we need to configure the convention plugin a bit:
REST and non-RESTful URL's Together ConfigurationIf you want to keep using some non-RESTful URL's alongside your REST stuff, then you'll have to provide for a configuration that utilizes to mappers.
First, you'll need to re-assert the extensions that struts knows about because the rest plugin will have thrown out the default action extension.
Next, we will configure the PrefixBasedActionMapper, which is part of the core Struts 2 distribution, to have some URL's routed to the Rest mapper and others to the default mapper.
And, again, we're relying on the Convention plugin to find our controllers, so we need to configure the convention plugin a bit:
Write Your Controller ActionsOnce everything is configured, you need to create the controllers. Controllers are simply actions created with the purpose of handling requests for a give RESTful resource. As we saw in the mapping logic above, various REST URL's will hit different methods on the controller. Traditionally, normal Struts 2 actions expose the execute method as their target method. Here's a sample controller for a orders resource. Note, this sample doesn't implement all of the methods that can be hit via the RESTful action mapper's interpretation of URL's.
In this example, the ModelDriven interface is used to ensure that only my model, the Order object in this case, is returned to the client, otherwise, the whole OrdersController object would be serialized.
You may wonder why the show() method returns a HttpHeaders object and the update() method returns the expected result code String. The REST Plugin adds support for action methods that return HttpHeaders objects as a way for the action to have more control over the response. In this example, we wanted to ensure the response included the ETag header and a last modified date so that the information will be cached properly by the client. The HttpHeaders object is a convenient way to control the response in a type-safe way.Also, notice we aren't returning the usual "success" result code in either method. This allows us to use the special features of the
to intuitively select the result template to process when this resource is accessed with the .xhtml extension. In this case, we can provide a customized XHTML view of the resource by creating /orders-show.jsp and /orders-update.jsp for the respective methods.Advanced TopicsThe following sections describe some of the non-standard bells and whistles that you might need to utilize for your application's more non-standard requirements.Custom ContentTypeHandlersIf you need to handle extensions that aren't supported by the default handlers, you can create your own ContentTypeHandler implementation and define it in your struts.xml:
If the built-in content type handlers don't do what you need, you can override the handling of any extension by providing an alternate handler. First, define your own ContentTypeHandler and declare with its own alias. For example:
Then, tell the REST Plugin to override the handler for the desired extension with yours. In struts.properties, it would look like this:
Use Jackson framework as JSON ContentTypeHandlerThe default JSON Content Handler is build on top of the . If you prefer to use the
for JSON serialisation, you can configure the JacksonLibHandler as Content Handler for your json requests. First you need to add the jackson dependency to your web application by downloading the jar file and put it under WEB-INF/lib or by adding following xml snippet to your dependencies section in the pom.xml when you are using maven as build system.
Now you can overwrite the Content Handler with the Jackson Content Handler in the struts.xml:
 SettingsThe following settings can be customized. See the . For more configuration options see the SettingDescriptionDefaultPossible Valuesstruts.rest.handlerOverride.EXTENSIONThe alias for the ContentTypeHandler implementation that handles the EXTENSION valueN/AAny declared alias for a ContentTypeHandler implementationstruts.rest.defaultExtensionThe default extension to use when none is explicitly specified in the requestxhtmlAny extensionstruts.rest.validationFailureStatusCodeThe HTTP status code to return on validation failure400Any HTTP status code as an integerstruts.rest.namespaceOptional parameter to specify namespace for REST services/eg. /reststruts.rest.content.restrictToGETOptional parameter, if set to true blocks returning content from any other methods than GET, if set to false, the content can be returned for any kind of methodtrueeg. put struts.rest.content.restrictToGET = false in struts.propertiesResources - Short RESTful Rails tutorial (PDF, multiple languages) - Highly recommend book from O'Reilly - Presentation by Don Brown at ApacheCon US 2008Version HistoryFrom Struts 2.1.1+struts2上传文件,JavaScript判断文件大小 - Jayk Lin - ITeye技术网站
博客分类:
项目需求:使用Ext的FormPanel,在formpanel里面定义一个Ext.ux.form.FileUploadField(由ExtJS官方提供的一个上传组件)。而服务端使用commons-fileupload.jar结合Struts2实现文件上传功能。
commons-fileupload 初始状态下最大上传文件大小为2MB。如需要修改,可在struts.xml文件中添加:&constant name="struts.multipart.maxSize" value="" /& 我这里使用最大上传文件大小为20MB。
现在服务端可以说,已经可以实现上传了。主要在前台客户端。首先定义一个FileUploadField,用于选择上传文件var fileIO_fileUploadField = new Ext.ux.form.FileUploadField({
id:"fileIO_fileUploadField",
name:"file",
fieldLabel:"上传文件",
buttonText:"浏览...",
allowBlank:false,
emptyText:"小于20MB的文件"
}); 之后再FromPanel的items属性中引用,如var formpanel = new Ext.form.FormPanel({
id:"fileform",
.......//一些关于Formpanel的其他属性
items:[fileIO_fileUploadField,....]}) 通过Formpanel提供的submit()方法提交到后台。
这里主要说说,在执行formpanel.form.submit({...})之前,使用JavaScript对上传文件大小的判断,看代码getBrowserType = function(){
var Sys = {ie:false,firefox:false,chrome:false};
var ua = window.navigator.userA
if (ua.indexOf("MSIE")&=1){
}else if(ua.indexOf("Firefox")&=1){
Sys.firefox =
}else if(ua.indexOf("Chrome")&=1){
Sys.chrome =
getFileSize = function(obj){
var filesize = 0;
alert(obj.value);
var Sys = getBrowserType();
if(Sys.ie){
//IE7.0、IE8 在上传表单上,显示如“C:\fakepath\[文件名]”
//需要获得正确的文件物理地址value
var agent = window.navigator.userAgent
alert(agent.toString());
var IE7 = agent.indexOf("MSIE 7.0") != -1;
var IE8 = agent.indexOf("MSIE 8.0") != -1;
if(IE7 || IE8){
obj.select();
value = document.selection.createRange().
value = Object.
var img = new Image();
img.dynsrc =
return filesize = img.fileS
window.oldOnError = window.
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
return filesize = 0;
fso = new ActiveXObject('Scripting.FileSystemObject');
var file = fso.GetFile(value);
window.onerror = window.oldOnE
return filesize =
}catch(err){
Ext.Msg.alert("提示","您的IE浏览器暂时不能计算上传的文件大小。请上传小于20MB的文件!" +
"\n\n解决方案:工具——&Internet选项——&安全——&可信站点——&站点,添加本系统站点")
return filesize =0;
}else if(Sys.firefox || Sys.chrome){
return filesize = obj.files[0].fileS
}else return filesize = 0;
} 附件提供了FileUploadField组件及本实例代码
下载次数: 210
浏览: 76233 次
来自: 广州
我的配置和你的差不多,调了有一些效果,但是还不是很满意。
dxb350352 写道怎么用啊,运行完了也不知道取值的方法结 ...
怎么用啊,运行完了也不知道取值的方法
相同问题,解决了!
不知道上传失败该怎么从plubpload上体现出错的内容如下
Struts Problem Report
Struts has detected an unhandled exception:
antlr.RecognitionException
antlr/RecognitionException
File: org/apache/catalina/loader/WebappClassLoader.java
Line number: 1,358
Stacktraces
java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:510)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)
java.lang.NoClassDefFoundError: antlr/RecognitionException
org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:59)
org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:98)
org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:80)
org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:119)
org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:215)
org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:193)
org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1649)
com.idealism.kanban.dao.impl.UserDaoImpl.LoadUserByLogin(UserDaoImpl.java:42)
com.idealism.kanban.service.impl.LoginImpl.LoginCheck(LoginImpl.java:30)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy18.LoginCheck(Unknown Source)
com.idealism.kanban.action.LoginAction.CheckIn(LoginAction.java:53)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:510)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)
java.lang.ClassNotFoundException: antlr.RecognitionException
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:59)
org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:98)
org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:80)
org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:119)
org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:215)
org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:193)
org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1649)
com.idealism.kanban.dao.impl.UserDaoImpl.LoadUserByLogin(UserDaoImpl.java:42)
com.idealism.kanban.service.impl.LoginImpl.LoginCheck(LoginImpl.java:30)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy18.LoginCheck(Unknown Source)
com.idealism.kanban.action.LoginAction.CheckIn(LoginAction.java:53)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:510)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)
这是我web.xml的内容:
&?xml version="1.0" encoding="UTF-8"?&
&web-app id="WebAppID" version="3.0" xmlns="/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="/xml/ns/javaee
/xml/ns/javaee/web-app_3_0.xsd"&
&!-- 配置spring3.x的上下文配置文件.没有的话spring会报错 --&
&context-param&
&param-name&contextConfigLocation&/param-name&
&param-value&classpath:applicationContext.xml&/param-value&
&/context-param&
&!-- spring3.x上下文监听器 START --&
&listener&
&listener-class&org.springframework.web.context.ContextLoaderListener&/listener-class&
&/listener&
&!-- spring3.x上下文监听器 END --&
&!-- Struts2开始 --&
&filter-name&struts2&/filter-name&
&filter-class&org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
&/filter-class&
&filter-mapping&
&filter-name&struts2&/filter-name&
&url-pattern&/*&/url-pattern&
&/filter-mapping&
&filter-name&OpenSessionInViewFilter&/filter-name&
&filter-class&
org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
&/filter-class&
&init-param&
&param-name&sessionFactoryBeanName&/param-name&
&param-value&sessionFactory&/param-value&
&/init-param&
&filter-mapping&
&filter-name&OpenSessionInViewFilter&/filter-name&
&url-pattern&/*&/url-pattern&
&/filter-mapping&
&!-- Struts2结束 --&
&welcome-file-list&
&welcome-file&index.jsp&/welcome-file&
&/welcome-file-list&
&/web-app&
这是我strtus.xml的内容
&?xml version="1.0" encoding="UTF-8"?&
&!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd"&
&constant name="struts.i18n.encoding" value="utf-8" /&
&constant name="struts.serve.static.browserCache" value="false" /&
&constant name="struts.configuration.xml.reload" value="true" /&
&constant name="struts.custom.i18n.resources" value="message,error"&&/constant&
&!-- 动态方法调用,为true时,就可以在struts.xml配置“*”的通配符,来调用action里的方法 --&
&constant name="struts.enable.DynamicMethodInvocation" value="false" /&
&!-- 开发模式 --&
&constant name="struts.devMode" value="true" /&
&constant name="struts.multipart.saveDir" value="/tmp" /&
&constant name="struts.ui.theme" value="simple" /&
&!-- 在struts.xml声明,action交给spring3.x托管 --&
&constant name="struts.objectFactory" value="spring" /&
&constant name="struts.multipart.maxSize" value="" /&
&!-- 默认后缀名 --&
&constant name="struts.action.extension" value="do,action,jhtml,," /&
&!-- Struts Annotation --&
&constant name="actionPackages" value="com.idealism.kanban.action" /&
&package name="SystemInstall" namespace="/install" extends="struts-default"&
&default-action-ref name="install" /&
&action name="install" class="com.idealism.kanban.action.SystemInstallAction" method="ReadInfo"&
&result&/install/install.jsp&/result&
&action name="System*" class="com.idealism.kanban.action.System{1}Action" method="{1}"&
&/package&
&package name="default" namespace="/" extends="struts-default"&
&default-action-ref name="index" /&
&action name="index"&
&result&index.jsp&/result&
&action name="Login*" class="com.idealism.kanban.action.LoginAction" method="{1}"&
&result name="admin"&/admin/index.jsp&/result&
&result&index.jsp&/result&
&/package&
这是我applicationContext.xml的内容:
&?xml version="1.0" encoding="UTF-8"?&
&!-- 指定Spring配置文件的Schema信息 --&
&beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"&
&!-- 使用 annotation --&
&context:annotation-config /&
&!-- 使用 annotation 自动注册bean,并检查@Controller, @Service, @Repository注解已被注入 --&
&context:component-scan base-package="com.idealism.kanban"/&
&context:property-placeholder location="classpath:jdbc.properties" /&
&bean id="dataSource" class="mons.dbcp.BasicDataSource" destroy-method="close"&
&property name="driverClassName" value="${DriverClassName}" /&
&property name="url" value="${Connect}://${DBUrl}/${DBName}?useUnicode=${UseUnicode}&characterEncoding=${CharacterEncoding}" /&
&property name="username" value="${DBUserName}" /&
&property name="password" value="${DBPassword}" /&
&property name="initialSize" value="${InitialSize}" /&
&property name="maxActive" value="${MaxActive}" /&
&property name="maxIdle" value="${MaxIdle}" /&
&property name="minIdle" value="${MinIdle}" /&
&!-- sessionFactory --&
&bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&
&property name="dataSource"&
&ref bean="dataSource" /&
&/property&
&property name="packagesToScan"&
&value&com.idealism.kanban.model&/value&
&/property&
&property name="hibernateProperties"&
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.use_second_level_cache=false
hibernate.cache.use_query_cache=false
&/property&
&!-- 开启AOP监听 只对当前配置文件有效 --&
&aop:aspectj-autoproxy expose-proxy="true" /&
&!-- 开启注解事务 只对当前配置文件有效 --&
&tx:annotation-driven transaction-manager="txManager" /&
&!-- sessionFactory 加入事务管理器中 --&
&bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&
&property name="sessionFactory" ref="sessionFactory"&&/property&
&!-- 事务管理 --&
&tx:advice id="txAdvice" transaction-manager="txManager"&
&tx:attributes&
&tx:method name="save*" propagation="REQUIRED" /&
&tx:method name="add*" propagation="REQUIRED" /&
&tx:method name="create*" propagation="REQUIRED" /&
&tx:method name="insert*" propagation="REQUIRED" /&
&tx:method name="update*" propagation="REQUIRED" /&
&tx:method name="merge*" propagation="REQUIRED" /&
&tx:method name="del*" propagation="REQUIRED" /&
&tx:method name="remove*" propagation="REQUIRED" /&
&tx:method name="put*" propagation="REQUIRED" /&
&tx:method name="use*" propagation="REQUIRED"/&
&!--hibernate4必须配置为开启事务 否则 getCurrentSession()获取不到--&
&tx:method name="get*" propagation="REQUIRED" read-only="true" /&
&tx:method name="count*" propagation="REQUIRED" read-only="true" /&
&tx:method name="find*" propagation="REQUIRED" read-only="true" /&
&tx:method name="list*" propagation="REQUIRED" read-only="true" /&
&tx:method name="*" read-only="true" /&
&/tx:attributes&
&/tx:advice&
&aop:config expose-proxy="true"&
&!-- 只对业务逻辑层实施事务 --&
&aop:pointcut id="txPointcut" expression="execution(* com.idealism.kanban..service..*.*(..))" /&
&aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/&
&/aop:config&
这是我的action的内容:
package com.idealism.kanban.
import java.io.IOE
import java.io.PrintW
import java.util.L
import java.util.M
import javax.annotation.R
import javax.servlet.http.HttpServletR
import org.apache.struts2.ServletActionC
import org.springframework.stereotype.C
import com.idealism.kanban.dao.PrivilegeD
import com.idealism.kanban.dao.impl.PrivilegeDaoI
import com.idealism.kanban.model.P
import com.idealism.kanban.model.U
import com.idealism.kanban.service.L
import com.idealism.kanban.util.PrivilegeU
import com.idealism.kanban.vo.LoginI
import com.opensymphony.xwork2.ActionC
import com.opensymphony.xwork2.ActionS
import com.opensymphony.xwork2.ModelD
@Controller("LoginAction")
public class LoginAction extends ActionSupport implements ModelDriven&LoginInfo& {
private LoginInfo loginInfo = new LoginInfo();
private Login loginS
private PrivilegeDao privilege = new PrivilegeDaoImpl();
public Login getLoginService()
return loginS
public void setLoginService(Login loginService)
this.loginService = loginS
public LoginInfo getLoginInfo() {
return loginI
public void setLoginInfo(LoginInfo loginInfo) {
this.loginInfo = loginI
public String CheckIn(){
String error = "";
List&Users& users = getLoginService().LoginCheck(loginInfo);
if(users.size() & 0){
for(Users u:users){
loginService.SaveLoginTime(u);
MakeUpPri(u);
if(loginInfo.getLoginType().equals("1")){
error = getText("error.login.nameorpwd");
HttpServletResponse response = (HttpServletResponse) ActionContext.getContext().get(ServletActionContext.HTTP_RESPONSE);
response.setCharacterEncoding("utf-8");
PrintWriter out =
out = response.getWriter();
} catch (IOException e1) {
e1.printStackTrace();
out.print(getText("error.login.nameorpwd"));
out.flush();
out.close();
return "";
public void MakeUpPri(Users users){
List&Privilege& PriList = privilege.LoadAll();
Map&String, Object& s = ActionContext.getContext().getSession();
String UserPri = users.getPrivilege();
s.put("user_id", users.getUser_id());
s.put("user_account", users.getUser_account());
s.put("user_name", users.getUser_name());
PrivilegeUtil priutil = new PrivilegeUtil();
for (int i = 0; i & PriList.size(); i++) {
s.put(PriList.get(i).getPrivilege_define(),priutil.PriStringToDec(UserPri.substring(i*2, i*2+3)));
public LoginInfo getModel() {
return loginI
这是我service的内容
package com.idealism.kanban.service.
import java.sql.D
import java.util.L
import org.springframework.beans.factory.annotation.A
import org.springframework.beans.factory.annotation.Q
import org.springframework.stereotype.S
import com.idealism.kanban.dao.UserD
import com.idealism.kanban.model.U
import com.idealism.kanban.service.L
import com.idealism.kanban.util.
import com.idealism.kanban.vo.LoginI
@Service("LoginService")
public class LoginImpl implements Login {
@Autowired
@Qualifier("UserDao")
private UserDao userD
public LoginImpl(){
public List&Users& LoginCheck(LoginInfo loginInfo){
return userDao.LoadUserByLogin(loginInfo.getUser_account(),new encryption().encryptString(loginInfo.getPassword()));
public void SaveLoginTime(Users users){
users.setLogin_time(new Date(System.currentTimeMillis()));
userDao.SaveUser(users);
这是我DAO的内容:
package com.idealism.kanban.dao.
import java.util.L
import org.hibernate.C
import org.hibernate.S
import org.hibernate.SessionF
import org.hibernate.criterion.O
import org.hibernate.criterion.R
import org.springframework.beans.factory.annotation.A
import org.springframework.stereotype.R
import com.idealism.kanban.dao.UserD
import com.idealism.kanban.model.U
import com.idealism.kanban.vo.UserI
@Repository("UserDao")
public class UserDaoImpl implements UserDao {
private static final String LoadByLoginCheck = "from Users u where u.user_account = :user_account and u.password = :password";
private static final String LoadById = "from Users u where u.user_id = :user_id";
private SessionFactory sessionF
public Session getSession() {
return sessionFactory.getCurrentSession();
@Autowired
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionF
public void SaveUser(Users u) {
getSession().saveOrUpdate(u);
@SuppressWarnings("unchecked")
public List&Users& LoadUserByLogin(String user_account,String password) {
return (List&Users&) getSession().createQuery(LoadByLoginCheck).setParameter("user_account", user_account).setParameter("password", password);
public Users LoadUserByID(int id) {
return (Users) getSession().createQuery(LoadById).setParameter("user_id", id);
@SuppressWarnings("rawtypes")
public List SearchUsers(UserInfo user) {
Criteria c = getSession().createCriteria(Users.class);
if (null != user.getMax_create_time() && !user.getMax_create_time().equals("")) {
c.add(Restrictions.lt("create_time",user.getMax_create_time()));
if (user.getMin_create_time() != null && !user.getMin_create_time().equals("")) {
c.add(Restrictions.ge("create_time",user.getMin_create_time()));
if (user.getMax_login_time() != null && !user.getMax_login_time().equals("")) {
c.add(Restrictions.lt("login_time", user.getMax_login_time()));
if (user.getMin_login_time() != null && !user.getMin_login_time().equals("")) {
c.add(Restrictions.ge("login_time",user.getMin_login_time()));
if (user.getUser_account() != null && !user.getUser_account().equals("")) {
c.add(Restrictions.like("user_account", user.getUser_account()));
if (user.getUser_name() != null && !user.getUser_name().equals("")) {
c.add(Restrictions.like("user_name", user.getUser_name()));
if (user.getOrderByField() != null && user.getOrderByField().equals("") && user.getOrderBySort() != null && user.getOrderBySort().equals("")) {
if(user.getOrderBySort() == "ASC"){
c.addOrder(Order.asc(user.getOrderByField()));
c.addOrder(Order.desc(user.getOrderByField()));
c.setFirstResult(user.getFirstResult());
c.setMaxResults(user.getPageSize());
return c.list();
java.lang.ClassNotFoundException: antlr.RecognitionException&
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)&
org/antlr/runtime/RecognitionException 是antlr异常的基础类, 所以, 你肯定是少了antlr.jar
已解决问题
未解决问题

我要回帖

更多关于 struts1 的文章

 

随机推荐