Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java to JSP. How to?

Tags:

java

jsp

i have written a java program which currently runs as a desktop app,

it is returning all results accurately as required in the console. I am now faced by a challenge to convert this application to a web application (JSP).

Currently, the code for my projects is in user/workspace (as i am using eclipse)

and my tomcat has been installed at c:/server/tomcat..

I am basically a .net developer and know peanuts about java web development. Can someone please guide me as to how i can convert my current project into a web application?

how do i include the project in user/workspace in the jsp file? havent done it before so its as confusing as hell.

it will be most helpful if you can point me in the right directon, or even provide some links so that I can use thm as a pointer

Many Thanks in Advance.

like image 614
Mponnada Avatar asked Jan 21 '26 13:01

Mponnada


2 Answers

I suggest not to use the JSP technology anymore unless you have to (-> customer demands it).

Instead, get GWT or Grails. Both come with tools to setup a project in Eclipse from scratch that compiles and can be run with the press of a button. Also, both technologies are much more advanced than JSP and you'll find them much more simple to understand as a .Net developer.

like image 179
Aaron Digulla Avatar answered Jan 24 '26 04:01

Aaron Digulla


If all you want do do is to display the output in a html page, the simplest ways is still to use jsp.

You can do as mentioned in kgiannakakis answer

If your class already returns a string with a nice output, everything you need do this.

<%
MyClass = new MyClass();

%>

<pre>  <%-- pure html, preformatted --%>
<%= myClass.formattedStuff();    %>
</pre>

No fancy html formatting, though. Just a text dump.

You can use for-loops and if-clauses and what not, as everything between <% %> is normal java.

If you need more functionality, You should probably not bother with jsp at all. (And absolutely not at all with JSTL, which would be a total waste of time if you are not intending to start a career writing web apps for big enterprises.

Perhaps GWT :-) Its almost java.

like image 27
KarlP Avatar answered Jan 24 '26 02:01

KarlP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!