submitaction.java

来自「一个非常简单但是实用的struts入门代码」· Java 代码 · 共 27 行

JAVA
27
字号
package submit;import javax.servlet.http.*;import org.apache.struts.action.*;public final class SubmitAction extends Action {  // The execute() method is where you provide your business logic  public ActionForward execute(ActionMapping mapping,                               ActionForm form,                               HttpServletRequest request,                               HttpServletResponse response) {    //  Cast ActionForm object to SubmitForm type    SubmitForm f = (SubmitForm) form;    //  Retrieve the value of lastname field    String lastName = f.getLastName();    //  Translate the lastname to upper case and save it Request scope    request.setAttribute("lastName", lastName.toUpperCase());       //  Create and return ActionForward object with "success" outcome    return (mapping.findForward("success"));  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?