Jump to content

How do I config the Servet from the web application?


BOS

Recommended Posts

Hello everyone,I'm new and seeking help in the ASP.NET in C#, I have a webform application and when a user click a button on the application's page, the information that the user entered on the page is sent to the Servlet, I have a pageServlet files in Java and along with other files related to pageServlet. I put all the pageServlet files in the Apppath folder in the project and in the next button on the form application called Response.Redirect("http://localhost:4943/newwebmap07/AppPath/pageServlet");It could not locate or transfer to the pageServlet when click the next button on the webform, Can someone show me how to config this, where to put those files and call it, I'm using the Microsoft Visual Studio 05 for ASP.NET web application, thanks so much :-)

Link to comment
Share on other sites

The .Net CLR cannot interpret Java or read JAR files.The follow post shows an attempt by someone to do just this (Except the servelt will have to be on a funcitoing Java Server (ie Tomcat) not on the .Net server.http://forum.csharp-online.net/viewtopic.p...34e2304bc2f0eedYou will have to create the "middleware" that will pass requests and responses back and forth.If your servlet doesn't require any data passed into it then a simple screen scrap should do the trick.

Link to comment
Share on other sites

The .Net CLR cannot interpret Java or read JAR files.The follow post shows an attempt by someone to do just this (Except the servelt will have to be on a funcitoing Java Server (ie Tomcat) not on the .Net server.http://forum.csharp-online.net/viewtopic.p...34e2304bc2f0eedYou will have to create the "middleware" that will pass requests and responses back and forth.If your servlet doesn't require any data passed into it then a simple screen scrap should do the trick.
Thanks aspnetguy for replying, if the .NET CLR can't interpret Java or Read JAR files, Can you convert it into a c# or it has to be in Java, and Is there another way to get connected to the pageServlet Java files using the localhost url because I try sample one in the link you give it to me, still not passing any requests and responses from the pageServlet, and in the pageServlet, I want to grab user address input and populate it to the Addressform, Below is my next called to the pageServlet and it is could not located the page, I'm still confusing of where the pageServlet and all others files resided in the project and also how to call those files..Can you give me a hint or some code connection, thanks in advanceprotected void btnNext_ServerClick(object sender, System.EventArgs e){ (Page.IsValid) { InsertRequestorInfor(Session["user"].ToString() ); Response.Redirect(ConfigurationSettings.AppSettings.Get("MapInforWebPath") + "?transid=" + Session ["userid"] + "&username=" + Session["user"] + "&password=" + Session["password"]+ "&requesttype=" + "&requestorname=" + iptName.Value + "&email=" + iptEmail.Value); //<add key="MapInforWebPath" value="http://localhost:8080/NewWebMap07/pageServlet"/> } }
Link to comment
Share on other sites

aspnetguy may be correct about .NET not being able to interpret Java servlets, but you can Response.Redirect to anything you want. If you have PHP configured on your web server and you want a .NET page to send control over to the PHP page, you simple use:

Response.Redirect("mypage.php");

And the PHP interpreter takes over control of the request. So, if you have Tomcat (or some other mechanism for running Java servlets) running, you should be able to send control over to it:

Response.Redirect("myservlet");

The real test here is whether you can put http://localhost:8080/NewWebMap07/pageServlet in your address bar and have your browser load the page. If not, then you need to make sure your web server is configured to run Java servlets.

Link to comment
Share on other sites

aspnetguy may be correct about .NET not being able to interpret Java servlets, but you can Response.Redirect to anything you want. If you have PHP configured on your web server and you want a .NET page to send control over to the PHP page, you simple use:
Response.Redirect("mypage.php");

And the PHP interpreter takes over control of the request. So, if you have Tomcat (or some other mechanism for running Java servlets) running, you should be able to send control over to it:

Response.Redirect("myservlet");

The real test here is whether you can put http://localhost:8080/NewWebMap07/pageServlet in your address bar and have your browser load the page. If not, then you need to make sure your web server is configured to run Java servlets.

s it possible to run Java over IIS? I don't think it is. You will probably have to use 2 servers or rewrite the code into C# to perform your task.
Link to comment
Share on other sites

No, I'm not aware of any way to run Java on IIS. Back when I was a mainly a freelancer, I had to do what you have suggested and have multiple webservers running locally.

Link to comment
Share on other sites

Thanks Jesh and aspnetguy for trying to help me out, really appreciated!I'm very new to ASP.NET and trying to modify a web form for a company, In the old webform, after the requestor hits the next button, it directed to the pageServlet to populated the form and the map, My new project is adding another webform in after the requestor.aspx page and directed from the new webform to the PapeServlet and allow ASP page to pre-populate information like name, address, city,state,zip in the PageServlet form. I'm trying to connect to the pageServlet.Java, but unsuccessful, page could not located ..The one we runs on right now is not local servlet, but on the dormain host server, take a look at this link http://www.fsappserv2.com:8080/newwebmap/F...l=123@yahoo.com I'm try to test and see if it connects to the pageServlet on the localhost, but unsucessessfull connected, because it could not located the pageSo is there a way to populated a ASP.NET form to the PageServlet ?protected void btnNext_ServerClick(object sender, System.EventArgs e){(Page.IsValid){InsertRequestorInfor(Session["user"].ToString() );Response.Redirect(ConfigurationSettings.AppSettings.Get("MapInforWebPath") + "?transid=" + Session ["userid"] + "&username=" + Session["user"] + "&password=" + Session["password"]+ "&requesttype=" + "&requestorname=" + iptName.Value + "&email=" + iptEmail.Value);//Configured In Web.Config // <add key="MapInforWebPath" value="http://localhost:8080/NewWebMap07/pageServlet"/>}}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...