Tag:struts2

  • Ajax struts 2 drop-down box assignment (suitable for all)

    Time:2021-10-11

    1. This code is applicable to all drop-down list values2. All drop-down lists of an item only need this public method;Step 1: create entity bean; Copy codeThe code is as follows: public class DictionaryBean { private String value_ Id;// The ID of the drop-down box optionprivate String value;// The value of the drop-down box optionprivate […]

  • Struts 2 + Spring + Hibernate paging code [more] page 1 / 7

    Time:2021-9-18

    Dao layer interface:Java code Copy codeThe code is as follows: package com.last999.im.news.dao; import java.util.*; import com.last999.im.news.entity.KindEntity; import com.last999.im.news.web.PageTool; public interface KindEntityDao{ public KindEntity get(String uuid); public void save(KindEntity kindEntity); public void update(KindEntity kindEntity); public void delete(String uuid); public void delete(KindEntity kindEntity); public List<KindEntity> findAll(); public KindEntity findKindEntityByName(String name); public List<KindEntity> getKindEntity(PageTool pageInfo); public int getRows(); […]

  • Ajax interaction action of struts 2 (client / server side)

    Time:2021-8-26

    1. Client web page code Copy codeThe code is as follows: <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=GB18030″> < title > check whether the user name is unique < / Title ><script language=”javascript”> function createRequest(url) { http_request = false; If (window. XMLHttpRequest) {/ / non IE browserhttp_ request […]

  • Interpretation of Struts2 session

    Time:2021-7-18

    HttpSession < session = ServletActionContext.getRequest().getSession();          Example:         public String findAll(){      HttpSession session = ServletActionContext.getRequest().getSession();         list = userService.find();      session.setAttribute(“list”, list);         return this.SUCCESS;     }          How to get the properties in session in JSP         As follows:          s:iterator value=”#session.list”             s:property value=”user.userid”             s:property value=”user.firstname”             s:property value=”user.lastname”          s:iterator

  • The problem of integrating fielderror with struts 2 spring

    Time:2021-7-16

    Question: The verification framework is used. After the JSP page fails to verify once, no matter whether the input is correct or not, it will not jump to the exception page. reason: When spring creates action objects, the default mode is singleton. Singleton means that spring only generates one object for an IOC container. In […]

  • Jump problem of Java Struts2 in interceptor

    Time:2021-6-29

    Copy codeThe code is as follows: java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:405) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:725) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:467) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:595) A search on the […]

  • Struts2 action jump to call another program

    Time:2021-5-7

    Purpose: to jump to call another program after an action is successful.Struts2.xml [html] Copy codeThe code is as follows: <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE struts PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 2.0//EN” “http://struts.apache.org/dtds/struts-2.0.dtd”> <struts> <!– Specify as development mode (default is false) – ><constant name=”struts.devMode” value=”false” /> <constant name=”struts.i18n.encoding” value=”UTF-8″/> <constant name=”struts.custom.i18n.resources” value=”message”></constant> <!– Upload file […]

  • Struts 2 accessing servlet sharing

    Time:2021-4-14

    1: Access or add the request / session / application property  Copy codeThe code is as follows: public String scope() throws Exception{    ActionContext ctx = ActionContext.getContext(); ctx.getApplication (). Put (“app”, “application scope”); / / put the app into ServletContext ctx.getSession (). Put (“session”, “session range”); / / put session into session ctx.put (“req”, “request […]

  • Ajax + JSON + Struts2 implementation of list transfer examples

    Time:2021-3-24

    Due to the need of internship, we need to get the values in the background list collection through Ajax. Since I haven’t touched it before, I will study it today.1、 First, you need to download the jar package that JSON depends on. It mainly depends on the following: json-lib-2.2.2-jdk15 ezmorph-1.0.4 commons-logging-1.0.4 commons-lang-2.4 commons-collections-3.2.1 commons-beanutils 2、 […]

  • The method of timing refresh by jQuery, Ajax and struts2

    Time:2021-3-3

    Step 1: import jQuery plug-in Copy codeThe code is as follows: <script type=”text/javascript” src=”js/easyui/jquery-1.8.0.min.js”></script> Step 2: add information display place in < body > < / body > Copy codeThe code is as follows: <label></label> Step 3: add JS code to the page Copy codeThe code is as follows: <script type=”text/javascript”>    setInterval(“Push()”,1000*60);    function Push() {           […]

  • Using Maven + eclipse to build Struts2 development environment

    Time:2020-11-17

    1、 Introduction to web layered structure1. Web [fine] granularity hierarchical structure: According to the fine-grained stratification, it can be divided into the following six types: 1) . presentation layer: HTML / CSS / JS / JSP 2) . control layer: Servlet 3) . entity layer: JavaBean 4) Business logic layer: JavaBean 5) . persistence layer: […]

  • A detailed explanation of the example of using struts 2 to integrate JavaMail

    Time:2020-11-1

    1、 Code PreviewThese two days in doing Struts2 mail sent. Previous projects are useful to spring, and it is convenient to use the mail support class provided by spring to complete this function. But now only using Struts2, we will encounter a series of problems. Please download the mail.jar , and activation.jar Add to classpath […]