Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert html to JSP

Status
Not open for further replies.

112055

Programmer
May 13, 2002
61
US
I have to convert a bunch of html files to JSP. There are lots of books just talked about one side or the other. i.e. straight talk on JSP or straight talk on html but not the technique or format how to do the convert from existing html files to JSP. Does anyone knows of some good sites or good books that teach how to convert html to JSP?

Many thanks.

 
Why do you need to convert from html to jsp? Do you know much about jsp now? ________________________
JoelMac
 
Just rename the extension from .html to .jsp.

This functionally does nothing, and results in more server load, but at least it accomplishes your mission to "convert html to jsp".

petey
 
The problem I think everyone is having with helping you on this issue is that html and JSP are two differant things. JSP is a server-side language that allows you to dynamically create HTML to send to the browser. The browser doesn't care if it is a JSP page, and ASP page, a PHP page, a cold fusion page, etc... as long as the content type (or MIME type) of the page is HTML it will render it as an html file.

petey was correct above in saying that all you need to do is change the extension. Since there is nothing in these files that needs to be processed as JSP they will still be static pages, but will cause extra load on your server as they need to be processed at least once for the server to realize there is nothing to do in them.

If, in fact, you meant that you would like to combine a large number of pages into a JSP script, this will take more information, as it could be anything from a listing of phone numbers that you would like to dynamically generate rather than type in manually to a members only site that currently uses javascript (client-side) to allow people to log in.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Tarwn, I believe you understand this more so. Since I last ask that question I have been learning it on my own that in the html files which calls the client side javascript, and also contains server side javascript, html tags etc.,...
I learn that in the html file, any 'var' has to change to 'String' or 'Int', ...'client.whatever' I have to use the HttpSession.mysession = pageContext.getSessio();
...and the <script>...</script> area can be untouched but if they are in between the try{} ..if {}....else{}...I have to make sure that they have <%....%> to contain them and not to forget bringing in the scriptlets, i.e.
<%@page import= &quot;com.ABC.ts.*&quot;%>
<%@page import= &quot;java.util.*&quot;%>


I am sure there are lots more as I continue to dig in. I guess I am hoping that some seniors out there who can point me a more direct route. Or may be I didn't explain clearly when asking for help.

Thanks.
 
One thing you will need to be careful of is the distinction between server-side and client-side. I will admit I have not written a great deal in JSP and that was close to a year ago, but in most cases server-side script cannot directly interact with client-side controls (ie, form inputs and the like). Also you will need to keep in mind that the server works off requests, ie until a request comes in for a page the server-side code cannot do anything. This may seema bit redundant or obvious but consider it in this light. Say you have a form and you would like to move the validation script to the server instead of running it client-side. The validation script will have to be on the page that the form submits to rather than the page that contains the form itself.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Maybe this question is better stated &quot;How do I build out my website's functionality with JSPs and servlets?&quot;. [ol][li]Install the latest JVM (Java Virtual Machine) from java.sun.com, if you haven't already. You don't need the J2EE package, the J2SE package is enough.[/li][li]Install the latest Jakarta Tomcat from jakarta.apache.org, if you haven't got a JSP-capable server yet. This JSP server software serves off port 8080 rather than the default 80, but you can connect your server to Tomcat with some configuration.[/li][li]Learn Java and the latest servlet/JSP specs, if you haven't.[/li][li]Map all of your logic into the servlet/JSP structure. Build objects, interfaces, beans, etc. Investigate using MVC (Model View Controller) architecture, and possibly JSTL and/or struts. Remember to put database passwords, data dirnames, etc, into a resource file and not hard-coded.[/li][/ol] Hope this helps! This is the right forum to post if you have more specific questions, but remember that there is an *enormous* amount of info and documentation on the web already.

petey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top