Way1: Embed Java code inside
The JSP page embeds the following code:
Test Cases:
Way2: via El expression
An explanation of the syntax for El expressions see: http://blog.csdn.net/qwerasdf123/article/details/4189889
Add the following code
/**
* Write the following Sessioncounter.java
* and compiled to Sessiioncounter.class
* Then put it on the classpath of your website
* Sessioncount (build this directory yourself) below
*/
Package sessioncount;Import javax.servlet.*;Import
ExtJS, though powerful, is difficult to debug. It was a great effort but eventually succeeded. A summary of the skills of the learning knowledge I will be summarized in the next blog post. Now it's time to stick to the code.
Servlet Code (note I
Look at the contents of the form:
ABCD
--------------------------------------------------------------------------------------------------------------- ---
The main code for SHOW.JSP is:
Your choice is: ${param.select}
-------------------------------
The compilation environment is eclipse.
First in the JSP page, make the following settings:
This allows you to obtain the directory of your project, if your project name is TestStruts2, then the BasePath value is:
1, the browser to the action pass parameters:
set the property in action and set the Get/set method for the property. Assign a value by the name of the property when passing the parameter. such as Xxx?name=aa
value with Request.getprameters
File uploads need to use the Cos.jar package. File upload the Display page index.jsp file is as follows:
File upload
The form must be submitted using post, and the phrase "Multipart/form-data" must be written
Example of an IFRAME usage in a JSP page:
First, add the following code where you want to include another page in the JSP page:
Then add the function in JavaScript, such as:
function Shezhi (Detail_code,detail_name,detail_fenzhi)
Basic">
Basic is the configuration in the Fckconfig.js in the Fckeditor.jar package, you can select Basic (Slim) or defaul (all works).
Put the value from the data to the FCK in the foreground page and modify it to write
${theme.themename}"/>
struts 2 File upload & Lt;mce:script language= "javascript" > Name= "caption" label= "caption"/>
The is transferred from the http://www.itzhe.cn/news/20080311/106898.html and sorted.
FCKeditor is a WYSIWYG text editor that is specifically designed to be in the open source code on a Web page. It is focused on lightweight and does not require too complex installation steps to be used. It can be combined with different programming
A simple reflection method in one of its own JSP was used to display the property method constructor of a class, as follows:
void Reflectapi (Javax.servlet.jsp.JspWriter out,string className) throws exception{Class Cls=class.forname
Web.xml: This type of writing is problematic in IE browser. "Show friendly HTTP error prompts" must be ticked off in the IE tools-> Internet Options-> "advanced"; but we can't control the client's browser 404 /error404.jsp 500 /error500.jsp ------
When you set the errorpage= "url" in the JSP page directive, you can set up a JSP file that handles exception events. If you can write this:
This way, when an exception occurs on the page, it automatically jumps to the error-handling page. But be
Summary of JSP page jump1. Requestdispatcher.forward () acts on the server side, and when using forward (), the Servlet engine passes HTTP requests from the current servlet or JSP to another servlet, JSP or normal HTML file, that is, your form
Like ordinary Java programs, you can introduce exceptions into
JSPIn If you are performing
JSPJava code, you can forward HTTP requests to another Web page that specifically handles exceptions with the following
The value of the action attribute of the form label in the JSP form, which is the path to the method in the Action Class (path), is known to be related to the path in struts's configuration file, which has the code to load the struts profile in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service