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)