File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes jsp and asp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp and asp" Watch "jsp and asp" New topic
Author

jsp and asp

xiaohui zhu
Greenhorn

Joined: Dec 28, 2004
Posts: 6
My knowledge of ASP and JSP is nearly zero. I need you guys help. I have an ASP script like the following:
<% @Language = "VBSCRIPT"%>
<%Respnse.buffer = true
Response.write "<Credentials userName=""" & Request.ServerVariables("HTTP_USER") & """ />"%>

I want to convert it into JSP, which can run on Apache.

Any help would be appreciated.

Julie
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I would start by finding out what HTTP_USER is.

The Request.ServerVariables in Microsoft ASP are a mixture of CGI variables, HTTP header variables, and Microsoft specific variables.
This means that there won't always be equivalent mechanism when you port your ASP apps to another platform.

Check with Microsoft's documentation to find out exactly what HTTP_USER is, then look in the J2EE API docs to see if there is an equivalent.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.html

If the value is a standard HTTP protocol header, and there isn't a specific method for retrieving it in the HttpServletRequest object, you might still be able to grab it with the getHeader(headerName) method.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
xiaohui zhu
Greenhorn

Joined: Dec 28, 2004
Posts: 6
Hi,

Thank you very much for the reply.
"HTTP_USER is CGI variable from another product. People told me that I can use the following:
<%
response.getWriter().write("<Crendentials userName=\"" + request.getHeader("USER") + "\"/>");
%>

I put it into the HTTP server, somehow, I got HTTP 500 error. :-( Do you have any idea?

Thank you very much.

Julie
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by xiaohui zhu:
Hi,

Thank you very much for the reply.
"HTTP_USER is CGI variable from another product. People told me that I can use the following:
<%
response.getWriter().write("<Crendentials userName=\"" + request.getHeader("USER") + "\"/>");
%>

I put it into the HTTP server, somehow, I got HTTP 500 error. :-( Do you have any idea?

Thank you very much.

Julie

Try just:


This will stop the server 500 error but I don't think you'll get a value for just 'USER'.
xiaohui zhu
Greenhorn

Joined: Dec 28, 2004
Posts: 6
Hi,

Thank you very much for the reply. I still get HTTP 500 error. :-(

Best regards,

Julie
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Can you post that section of the code?
Are you seeing a stack trace in the browser window?
Have you looked in the logs to see, specifically what's blowing up?
xiaohui zhu
Greenhorn

Joined: Dec 28, 2004
Posts: 6
Hi,

Thank you very much. Actually I created a file - user.jsp and put that line code into user.jsp. Then I put user.jsp into HTTP Server/root/doc/. I tried to use browse to call that file like "http://localhost/doc/user.jsp" and got 500 Error. I understand that I should deploy user.jsp into Apache? I do not have any knowledge of Web Service. However, it is much simple, if I use IIS and .asp as long as I enable IIS to accept the ASP page. Just wonder whether it is also same simple to do that in apache?

Best regards,

Julie
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The Apache Web Server doesn't support JSP by itself.
You would need to install a servlet container that supports JSP.

If this is something you're serious about learning, I would download
Tomcat and then look for some books and/or web tutorials on JSP/Servlets. (Tomcat can be coupled with the Apache Web Server)

We're happy to help if you get stuck on a specific issue while writing your JSPs but walking someone through the whole process, starting with installing a server is a bit beyond the scope of a forum like this.
xiaohui zhu
Greenhorn

Joined: Dec 28, 2004
Posts: 6
Hi,

Thank you very much for the suggestion and I also ran through some examples at your website, they are good for me!

I have another question. "<" is special character in JSP and I should use "<" to replace in my code:
<%
response.getWriter().write("<Crendentials userName=\"" + request.getHeader("USER") + "\"/>");
%>

If I want to use "<" instead of "<", what can I do? I know that my question is very crazy, however, I am using another software to get "<Crendentials userName" instead of "<Crendential userName" :-(

Best regards,

Julie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp and asp