如何在jsp按钮的属性中运行java rmi程序 在此处插入标题 登录成功 当点击jsp文件中的按钮时,需要运行下面的程序。 包com.studytrails.tutorials.springremotingrmiclient; 导入java.io.*; 导入java.io.File.*; 导入java.net.Socket; 导入java.net.UnknownHostException; 导入org.springframework.context.ApplicationContext; 导入org.springframework.context.support.ClassPathXmlApplicationContext; 导入org.springframework.core.io.Resource; 导入com.studytrails.tutorials.springremotingrmiserver.*; 公共类TestSpringRemotingRmi { 公共静态void main(字符串[]args)引发IOException { ApplicationContext context=new ClassPathXmlApplicationContext(“spring config client.xml”); GreetingService GreetingService=(GreetingService)context.getBean(“GreetingService”); String greetingMessage=greetingService.getGreeting(“Alpha”); System.out.println(“问候语为:“+greetingMessage”); greetingService.getText(); } }
在上面的程序中,我试图在jsp文件中执行按钮单击时运行java如何在jsp按钮的属性中运行java rmi程序 在此处插入标题 登录成功 当点击jsp文件中的按钮时,需要运行下面的程序。 包com.studytrails.tutorials.springremotingrmiclient; 导入java.io.*; 导入java.io.File.*; 导入java.net.Socket; 导入java.net.UnknownHostException; 导入org.springframework.context.ApplicationContext; 导入org.springframework.context.support.ClassPathXmlApplicationContext; 导入org.springframework.core.io.Resource; 导入com.studytrails.tutorials.springremotingrmiserver.*; 公共类TestSpringRemotingRmi { 公共静态void main(字符串[]args)引发IOException { ApplicationContext context=new ClassPathXmlApplicationContext(“spring config client.xml”); GreetingService GreetingService=(GreetingService)context.getBean(“GreetingService”); String greetingMessage=greetingService.getGreeting(“Alpha”); System.out.println(“问候语为:“+greetingMessage”); greetingService.getText(); } },java,jsp,Java,Jsp,在上面的程序中,我试图在jsp文件中执行按钮单击时运行javaTestSpringRemotingRmi类。MyServlet文件包含处理来自jsp文件的请求的代码。但我尝试使用jsp调用该调用的默认构造函数,但它不起作用。指导我解决这个问题 我只是使用main()方法 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
TestSpringRemotingRmi
类。MyServlet文件包含处理来自jsp文件的请求的代码。但我尝试使用jsp调用该调用的默认构造函数,但它不起作用。指导我解决这个问题 我只是使用main()方法
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="com.studytrails.tutorials.springremotingrmiclient.TestSpringRemotingRmi" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body bgcolor="red">
<h1><font color=blue>login successfull</font></h1>
<h2><font color="lightgreen">
<form action="${pageContext.request.contextPath}/MyServlet" method="post">
<input type=submit name="n1" value="Click here to play the video">
</form>
</h2>
</body>
</html>
Need to run the below program when clicking the button in jsp file.
package com.studytrails.tutorials.springremotingrmiclient;
import java.io.*;
import java.io.File.*;
import java.net.Socket;
import java.net.UnknownHostException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.Resource;
import com.studytrails.tutorials.springremotingrmiserver.*;
public class TestSpringRemotingRmi
{
public static void main(String[] args) throws IOException
{
ApplicationContext context = new ClassPathXmlApplicationContext("spring-config-client.xml");
GreetingService greetingService = (GreetingService)context.getBean("greetingService");
String greetingMessage = greetingService.getGreeting("Alpha");
System.out.println("The greeting message is : " + greetingMessage);
greetingService.getText();
}
}