怎么用html的某个标签调用jsp里的方法

html-css025

怎么用html的某个标签调用jsp里的方法,第1张

import java.io.*

import java.util.*

import org.jdom.*

import org.jdom.input.*

public class MyXMLReader2JDOM {

public static void main(String arge[]) {

long lasting = System.currentTimeMillis()

try {

SAXBuilder builder = new SAXBuilder()

Document doc = builder.build(new File("xmlcount.xml"))

Element foo = doc.getRootElement()

// List allChildren = foo.getChildren()

System.out.print( foo.getAttributeValue("month-count"))

System.out.println(foo.getAttributeValue("total-count"))

} catch (Exception e) {

e.printStackTrace()

}

}

}

补充:

System.out.print(foo.getChild("date").getText())

补充:

测试通过:

import java.io.*

import java.util.*

import org.jdom.*

import org.jdom.input.*

public class MyXMLReader2JDOM {

public static void main(String arge[]) {

try {

SAXBuilder builder = new SAXBuilder()

Document doc = builder.build(new File("D:/xmlcount.xml"))

Element foo = doc.getRootElement()

System.out.println("month-count : " + foo.getAttributeValue("month-count"))

System.out.println("total-count : " + foo.getAttributeValue("total-count"))

System.out.println("date : " + foo.getChild("date").getText())

} catch (Exception e) {

e.printStackTrace()

}

}

}

jsp传值给另一个jsp页面,主要的方式是将数据放在request对象中,然后在另一个页面拿到这个数据即可,代码如下:

A.jsp :通过post 和get、连接都可以传

a标签连接的:

<a herf='B.jsp?name=<%=name%>'>传递到B页面</a>

B.jsp :

B页面通过如下代码接收

<%

String name=request.getParameter("name")

out.println("接收到:"+name)

%>