Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28421 > unrolled thread

Running java on the server side?

Started bytadamsmar@gmail.com
First post2014-05-10 11:48 -0700
Last post2014-05-13 21:05 -0400
Articles 7 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Running java on the server side? tadamsmar@gmail.com - 2014-05-10 11:48 -0700
    Re: Running java on the server side? Arne Vajhøj <arne@vajhoej.dk> - 2014-05-10 15:00 -0400
    Re: Running java on the server side? Silvio <silvio@internet.com> - 2014-05-10 22:11 +0200
    Re: Running java on the server side? Roedy Green <see_website@mindprod.com.invalid> - 2014-05-11 18:26 -0700
      Re: Running java on the server side? Arne Vajhøj <arne@vajhoej.dk> - 2014-05-11 21:40 -0400
    Re: Running java on the server side? lipska the kat <lipskathekat@example.com> - 2014-05-12 09:35 +0100
      Re: Running java on the server side? Arne Vajhøj <arne@vajhoej.dk> - 2014-05-13 21:05 -0400

#28421 — Running java on the server side?

Fromtadamsmar@gmail.com
Date2014-05-10 11:48 -0700
SubjectRunning java on the server side?
Message-ID<5aee4c17-45ef-49a4-8840-ff5bcd0bd668@googlegroups.com>
I am looking into eliminating Java applets from a hobby website of mine.

The web currently has 2 applets that accept some configuration data and then do some calculations and display the results.

I am wondering if I can create Html accepts the configuration data, sends it to the server where a java application can run to crunch the results and create an html page.  Then, the html page can be displayed.

That way I can use the existing number crunching code in Java and have the interface all in Html and hopefully get rid of all the security issues of trying to run a program in the client.

I have pretty limited web development skills.  Heck, I thought applet development would be most of the skill I would need for this hobby!

Also, and better ideas for making the web site easier to use?  I don't know that this is the best solution.

The web site is www.poologic.com.  The applets are the poologic calculator and the roi calculator.

[toc] | [next] | [standalone]


#28422

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-05-10 15:00 -0400
Message-ID<536e7764$0$301$14726298@news.sunsite.dk>
In reply to#28421
On 5/10/2014 2:48 PM, tadamsmar@gmail.com wrote:
> I am looking into eliminating Java applets from a hobby website of mine.
>
> The web currently has 2 applets that accept some configuration data and then do some calculations and display the results.
>
> I am wondering if I can create Html accepts the configuration data, sends it to the server where a java application can run to crunch the results and create an html page.  Then, the html page can be displayed.
>
> That way I can use the existing number crunching code in Java and have the interface all in Html and hopefully get rid of all the security issues of trying to run a program in the client.
>
> I have pretty limited web development skills.  Heck, I thought applet development would be most of the skill I would need for this hobby!

Maybe you could replace the applet with some JavaScript?

You can run Java server side if your server supports it.

Most cheap web hotels targeting personal usage does not support Java.

Arne

[toc] | [prev] | [next] | [standalone]


#28423

FromSilvio <silvio@internet.com>
Date2014-05-10 22:11 +0200
Message-ID<536e8800$0$2867$e4fe514c@news2.news.xs4all.nl>
In reply to#28421
On 05/10/2014 08:48 PM, tadamsmar@gmail.com wrote:
> I am looking into eliminating Java applets from a hobby website of mine.
>
> The web currently has 2 applets that accept some configuration data and then do some calculations and display the results.
>
> I am wondering if I can create Html accepts the configuration data, sends it to the server where a java application can run to crunch the results and create an html page.  Then, the html page can be displayed.
>
> That way I can use the existing number crunching code in Java and have the interface all in Html and hopefully get rid of all the security issues of trying to run a program in the client.
>
> I have pretty limited web development skills.  Heck, I thought applet development would be most of the skill I would need for this hobby!
>
> Also, and better ideas for making the web site easier to use?  I don't know that this is the best solution.
>
> The web site is www.poologic.com.  The applets are the poologic calculator and the roi calculator.
>

You could do this easily with a servlet or two but to do that you would 
need a server that you can deploy your servlet to.

If it is worth you some money and you can handle a Linux server you 
could set yourself up with a DigitalOcean cloud server. They start at 5$ 
per month.

Cheers,

Silvio

[toc] | [prev] | [next] | [standalone]


#28440

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-05-11 18:26 -0700
Message-ID<pk80n954a0mkauec9can52jfdp4b6cnqek@4ax.com>
In reply to#28421
On Sat, 10 May 2014 11:48:29 -0700 (PDT), tadamsmar@gmail.com wrote,
quoted or indirectly quoted someone who said :

>Also, and better ideas for making the web site easier to use?  I don't know that this is the best solution.

The easiest thing to do would be to convert to a app which you run
locally.  All you need is a main method tacked on.  See
http://mindprod.com/jgloss/hybrid.html
for how.

Next hardest is convert to Java Web Start.
See http://mindprod.com/jgloss/javawebstart.html

Hardest is to write JSP or some other server side servlet code.
see http://mindprod.com/jgloss/jsp.html

The biggest problem is getting permission to meddle with server side
code.  You may need to find a new ISP.
see http://mindprod.com/jgloss/ispvendors.html
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Culture is your operating system. 
~ Terence McKenna (born: 1946-11-16 died: 2000-04-03 at age: 53)

[toc] | [prev] | [next] | [standalone]


#28441

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-05-11 21:40 -0400
Message-ID<5370267e$0$295$14726298@news.sunsite.dk>
In reply to#28440
On 5/11/2014 9:26 PM, Roedy Green wrote:
> On Sat, 10 May 2014 11:48:29 -0700 (PDT), tadamsmar@gmail.com wrote,
> quoted or indirectly quoted someone who said :
>
>> Also, and better ideas for making the web site easier to use?  I don't know that this is the best solution.
>
> The easiest thing to do would be to convert to a app which you run
> locally.  All you need is a main method tacked on.  See
> http://mindprod.com/jgloss/hybrid.html
> for how.

Easy to replace a web page using applets with an application?

That depends a bit on what those applets are doing.

If they are interacting with the page, then it is not an
easy port.

Sure you can make the applet itself to an application, but if
the applet is used for navigation in a web page, then that is not
a full solution.

Arne

[toc] | [prev] | [next] | [standalone]


#28444

Fromlipska the kat <lipskathekat@example.com>
Date2014-05-12 09:35 +0100
Message-ID<2L-dnaWQlJ1SGu3OnZ2dnUVZ8sqdnZ2d@bt.com>
In reply to#28421
On 10/05/14 19:48, tadamsmar@gmail.com wrote:
> I am looking into eliminating Java applets from a hobby website of mine.
>
> The web currently has 2 applets that accept some configuration data and then do some calculations and display the results.
>
> I am wondering if I can create Html accepts the configuration data, sends it to the server where a java application can run to crunch the results and create an html page.  Then, the html page can be displayed.
>
> That way I can use the existing number crunching code in Java and have the interface all in Html and hopefully get rid of all the security issues of trying to run a program in the client.
>
> I have pretty limited web development skills.  Heck, I thought applet development would be most of the skill I would need for this hobby!
>
> Also, and better ideas for making the web site easier to use?  I don't know that this is the best solution.
>
> The web site is www.poologic.com.  The applets are the poologic calculator and the roi calculator.
>

Here's some outline code, there is no exception handling and there
are a million other ways of doing it but this covers the basics.

[getdata.html]
...
<form action="/pathToSomeServlet" method="post">
    <input type="text" name="field1">
    ...
    //more input fields
    ...
</form>


[SomeServlet.java]
...
protected void doPost(HttpServletRequest request, ...){

     HttpSession session = request.getSession();
     String field1 = request.getParameter("field1");
     ...
     //get more parameters
     ...

     List<Foo> list = processParams(field1, field2, ...);
     //or
     List<Foo> list = processParams(HttpServletRequest request);

     ...
     session.setAttribute("results", list);
     ...
     String forwardTarget = "/someJsp.jsp");
     RequestDispatcher rd = null;
     rd = getServletContext().getRequestDispatcher(forwardTarget);
     rd.forward(request, response);
}


[someJsp.jsp]

List<Foo> results = (List<Foo>)session.getAttribute("results");

for(Foo f: results){
    //render f
}

//etc

There are all sorts of frameworks out there, there are all sorts of 
custom tags out there and there are a million naysayers and doom mongers 
just waiting to pull any solution you come up with to bits.

My philosophy?

Keep It Simple
and
If it feels good ... do it

HTH

-- 
lipska the kat - treacherous feline.
Proudly nominated for IPOTY 2014 - LIGAF
GNU/Linux user #560883 - linuxcounter.net

[toc] | [prev] | [next] | [standalone]


#28463

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-05-13 21:05 -0400
Message-ID<5372c16e$0$302$14726298@news.sunsite.dk>
In reply to#28444
On 5/12/2014 4:35 AM, lipska the kat wrote:
> On 10/05/14 19:48, tadamsmar@gmail.com wrote:
>> I am looking into eliminating Java applets from a hobby website of mine.
>>
>> The web currently has 2 applets that accept some configuration data
>> and then do some calculations and display the results.
>>
>> I am wondering if I can create Html accepts the configuration data,
>> sends it to the server where a java application can run to crunch the
>> results and create an html page.  Then, the html page can be displayed.
>>
>> That way I can use the existing number crunching code in Java and have
>> the interface all in Html and hopefully get rid of all the security
>> issues of trying to run a program in the client.
>>
>> I have pretty limited web development skills.  Heck, I thought applet
>> development would be most of the skill I would need for this hobby!
>>
>> Also, and better ideas for making the web site easier to use?  I don't
>> know that this is the best solution.
>>
>> The web site is www.poologic.com.  The applets are the poologic
>> calculator and the roi calculator.
>>
>
> Here's some outline code, there is no exception handling and there
> are a million other ways of doing it but this covers the basics.
>
> [getdata.html]
> ...
> <form action="/pathToSomeServlet" method="post">
>     <input type="text" name="field1">
>     ...
>     //more input fields
>     ...
> </form>
>
>
> [SomeServlet.java]
> ...
> protected void doPost(HttpServletRequest request, ...){
>
>      HttpSession session = request.getSession();
>      String field1 = request.getParameter("field1");
>      ...
>      //get more parameters
>      ...
>
>      List<Foo> list = processParams(field1, field2, ...);
>      //or
>      List<Foo> list = processParams(HttpServletRequest request);
>
>      ...
>      session.setAttribute("results", list);
>      ...
>      String forwardTarget = "/someJsp.jsp");
>      RequestDispatcher rd = null;
>      rd = getServletContext().getRequestDispatcher(forwardTarget);
>      rd.forward(request, response);
> }
>
>
> [someJsp.jsp]
>
> List<Foo> results = (List<Foo>)session.getAttribute("results");
>
> for(Foo f: results){
>     //render f
> }
>
> //etc
>
> There are all sorts of frameworks out there, there are all sorts of
> custom tags out there and there are a million naysayers and doom mongers
> just waiting to pull any solution you come up with to bits.
>
> My philosophy?
>
> Keep It Simple
> and
> If it feels good ... do it

Simple is often good

But you could probably make it even simpler by:
- storing data in request instead of session
- use JSTL for display

Arne

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web