Jbuilder9: how to configure the JSP runtime environment, Java advanced configuration, struts4.0, and the application of the three frameworks together

Source: Internet
Author: User
Tags tld

How to configure struts4.0
Step 1: Create a project.

2nd step: Create a webapplication by name (for example, book) and check jstl1.0 and struts1.1 (struts1.1) in the following selection basket. Press enter.

3rd step: Create a servlet in the Web selection item and add package to your desired package (such as PSL. ch1.ch2), and Class Name: chinafilter (whatever ). do not check two or more options in the middle. Select the filter servlet from the following single choice, then select the mapped servlet item in the next check, and then click. Remove the ore dressing from the create a runtime configuration.
Add request. setcharacterencoding ("gb2312") to try in the public void dofilter () method in the source code of the created file. Save and run .......

4th step: Create a JavaBean file. After writing the package and file name, if the content in the base class is javax. Swing. jpanel, change it to Java. Lang. object... and directly OK .. In the code, click the following bean selection item to add the member variable you want to save and run in properties...
Step 5th: Create an actionform file and set actionform to your own name. for example (bookform) and next, click Add... select items. The first item is name: is to write the name of your JavaBean instance, for example, (the name of book is the value of the name of your form in the future form, for example (input type = text name = "book. ID ). Type: select the path of your JavaBean .. Next, select the add to struts-config.xml hook, and then finish the line, and then enter the code to private book; this line is changed to private book = New Book ();....... then the file is complete ......... To save and run...

6th step: Create an action file and set the action to the action you want, for example (bookaction) and next .., frombean name selects the existing actionform file and changes the following options in sequence. The input JSP selection basket is the file to be displayed on the page. Write the file name, for example (listbook), and then finish .. in the code, change the content in the perform method to this form, for example
Public actionforward execute (actionmapping, actionform, httpservletrequest, httpservletresponse ){
/** @ Todo: complete the business logic here, this is just a skeleton .*/
Studentform = (studentform) actionform;
Httpservletrequest. setattribute ("Stu", studentform. getstudent ());
Return actionmapping. findforward ("liststudent ");
} This is only an important form. You just need to apply it. To save and run...

Step 7th: Create the editbook. jsp file. This file mainly writes some form information.
For example:
<Form method = "Post" Action = "studentaction. Do">
<Bean: Message key = "title. student. name "/> <input type =" type "name =" student. name "value = <C: Out value =" $ {student. name} "/> <HTML: errors property =" Err. null "/>
<Input type = "Submit" name = "Submit" value = "Submit">
<Input type = "reset" value = "reset">
</Form>
The bookaction in action = "bookaction. Do" is to add. Do to the file name of your action file ..
Step 8th: Create listbook. jsp
For example:
<% @ Page C %>
<% @ Taglib uri = "/WEB-INF/struts-bean.tld" prefix = "Bean" %>
<% @ Taglib uri = "/WEB-INF/struts-html.tld" prefix = "html" %>
<% @ Taglib uri = "http://java.sun.com/jstl/core" prefix = "C" %>
<HTML>
<Head>
<Title>
Liststudent
</Title>
</Head>
<Body bgcolor = "# ffffff">
<H1>
JBuilder [<C: Out value = "$ {Stu. name}"/>] generated JSP
</H1>
</Body>
</Html>
★By the way, you should select jstl1.0 as the first choice and struts1.1 as the first choice during JSP creation .......
9th step; configure the struts-config.xml file, select the maid mappings option to select one of the following and click the edit button next to it.
A page appears, click the forwards option below, and click Add next to it to generate an item. Select this option and click Edit next to it. Add the name of the file to be displayed on the page in the text basket, for example (listbook. jsp ). The 2nd text baskets are the path of the files displayed on the page, such as (/listbook. JSP) or click "..... "select listbook for this button. JSP file.
Now, a project is configured .......... if you try to do it several times, you will understand ................. [/B]

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.