*
The moose likes Servlets and the fly likes How do I call aspx from a servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How do I call aspx from a servlet?" Watch "How do I call aspx from a servlet?" New topic
Author

How do I call aspx from a servlet?

Janel Blakely
Greenhorn

Joined: Mar 30, 2011
Posts: 5
Is there a way to call an ASPX page in a servlet and pass data from the ASPX to servlet?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

You mean besides a link to an ASP page?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Janel Blakely
Greenhorn

Joined: Mar 30, 2011
Posts: 5
I don't know. I am very new to .NET programming and don't know Java. I have to update existing Java servlet code to set a variable that I can get from aspx code. We have several applications that were developed in Java to run in Oracle WebCenter portal that now need to run as webparts in MOSS. MOSS does not have a Java API. The only item the portlets need to work in MOSS is the current portal logged in user. I have aspx code that gets the current MOSS logged in user. Need to call the ASPX page in a servlet and get the username from the ASPX.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

If you need to "call" (poor choice of words) an ASP page under Java code control, you'll need to issue an HTTP request to the ASP page. You can pass data to the page via request parameters on the query string. The classes in java.net can help you, or you can use a higher level library such a HttpClient.

Data is passed back from the ASP page in the response.
Janel Blakely
Greenhorn

Joined: Mar 30, 2011
Posts: 5
Everywhere I have researched, I cannot find how to set the Response parameter in the aspx, in fact several discussions stated that you cannot do it. So, I went down another route and found javascript code that gets the MOSS username, but can't figure out to set the servlet variable = javascript variable.
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

Please pass the javascript variable as one of the query string parameters when calling the Servlet. Using the Servlet API
<code>
request.getParameter( <Parameter Name> );
</code>
you should be able to fetch the value in the Servlet.


S.D. MADHAN
Not many get the right opportunity !
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41115
    
  45
Janel Blakely wrote:Everywhere I have researched, I cannot find how to set the Response parameter in the aspx, in fact several discussions stated that you cannot do it. So, I went down another route and found javascript code that gets the MOSS username, but can't figure out to set the servlet variable = javascript variable.

What is a "response parameter"? Requests can have parameters in the URL, but responses don't. Is this an ASPX concept?

Mentioning JavaScript is confusing. So you're not implementing something along the lines of what Bear mentioned, which would be servlet --(HTTP request)--> ASPX resource --(HTTP response)--> servlet, but something that involves the client side?


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I call aspx from a servlet?
 
Similar Threads
Calling .aspx page from J2ME application
Getting Username from Sharepoint MOSS 2010
ejb
Servlet Calling?
EJB calls to servlet