


Today I wrote a landing page. I believe this is not difficult for everyone, but as a silk girl, I made a mistake once!
The login page form is submitted. In the action, I added the namespace. The details are as follows:
Login is fine. Problem, but the problem is that when my username or password is wrong, I should return to the login page. When I return, although the following method can be used to return to the specified html document
<package name="actionPackage" namespace="/actionPackage" extends="struts-default"> <action name="login" class="loginAction" method="execute"> <result name="success">/WEB-INF/index.html</result> <result name="error">/login.html</result> </action> </package>At this time, the problem comes. login.html introduces an external js file. The details are as follows:
<script language="javascript" type="text/javascript" src="jquery-1.8.0.min.js"></script>The problem lies here. When login.html is returned, the browser gets the js file. file, since the js file acquisition address is relative to the url, at this time, the problem really arises!
When logging in to submit the form, the actionPage namespace will be added to the URL. Then when returning to login.html, the URL will naturally include actionPage, causing the path to be obtained when getting the external js file. There is also an obvious space called actionPage in the file. Of course, this js external file cannot be obtained!
The url when logging in becomes http://localhost:8080/lfdcwtjxt/actionPage/login.action
When you return to the login page, the js acquisition path becomes http:/ /localhost:8080/lfdcwtjxt/actionPage/jquery-1.8.0,js
This is wrong, it should be http://localhost:8080/lfdcwtjxt/jquery-1.8.0,js
The solution is:
Use redirection to solve the problem: the configuration is as follows
<package name="actionPackage" namespace="/actionPackage" extends="struts-default"> <action name="login" class="loginAction" method="execute"> <result name="success">/WEB-INF/index.html</result> <result name="error" type="redirect">/login1</result> </action></package>Note: When redirecting, I used a slash /, that is to say , the action you are looking for is no longer in the current namespace, and jumps to another namespace, the default one!
Redirect configuration:
<package name="default" namespace="/" extends="struts-default"> <action name="login1"> <result>/login.html</result> </action></package>Okay, so the js acquisition path does not have the previous namespace!
I don’t know if there is any other way, welcome to kick the floor!

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
