Java+jsp+mysql Web page Production summary (2)

Source: Internet
Author: User

Some of the small ways to learn today:

Error: Chinese character error when URL is passed by get
Workaround: The Chinese characters will be garbled when URLs are passed through get.
1.String name1=request.getparameter ("name");
String name = new String (Name1.getbytes ("iso-8859-1"), "GBK");
2. Passing parameters via post


Error: Error when URL passed by get with space
Resolution: URL through get pass, is not passing the space, will only get the data before the space, so it is best to put the space to a bit


Implementing the Confirm Delete key
Write the function in the. js file:
function Delecheck ()
{
if (!confirm ("OK to delete?") "))
{
Window.event.returnValue = false;
}
}

In the JSP file, add:
<script language= "JavaScript" src=js/check.js></script>
<a href= ".... method=. &.. =.. "Onclick=" Delecheck () "> Remove operator

Method: Input Box input prompt code
The mouse point to the required field is empty, if the required fields are not filled, and the mouse in other places, the "Input keyword" display
<input name= "keyword" type= "text" value= "Please enter the keyword" onfocus= "this.value=" "onblur=" if (!value) {value=defaultvalue;} " >


Use the button to implement the jump page (use the onclick to jump to another page/jump to the specified URL):
1. Open in this window:
If this page shows you can use location directly, the method is as follows:

①onclick= "javascript:window.location.href= ' URL '"

②onclick= "location= ' URL '"

③onclick= "window.location.href= ' url?id=11 '"

If there is a frame in the page, you can add top.mainframe.frams[' right_frame ' in front of the location].location
Example:
<input type= "Submit" Name= "name" value= "Custom" onclick= "javascript:window.location.href= ' index.jsp '" ><input type= "Submit" Name= "name" value= "Custom" onclick= "window.location.href= ' lll?method=tuxiang&id=11 '" >

2. New Window
window.open (' index.jsp ')
Example:
<input type= "Submit" Name= "name" value= "Custom" onclick= "window.open (' index.jsp ')" >


Go back to the previous page:
Implemented with buttons: <input type= "button" Name= "Submit" onclick= "Javascript:history.back ( -1);" Value= "Back to previous" ><br>
No buttons: <a href= "javascript:;" onclick= "Javascript:history.back (-1);" > Back to prev </a>
Do with pictures: <a href= "javascript:;" onclick= "Javascript:history.back (-1);" ></a>

Java+jsp+mysql Web page Production summary (2)

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.