Running JSP

Hi

I try to write some JSP code with IntelliJ. So I start a new project and I choose web module and Tomcat as AS (all other stuffs I let with default values %MY_ACCOUNT_HOME%\IdeaProjects\myapp).

and I config Run/Debug Configurations > Tomcat server

My problems are:

1) My code is %MY_ACCOUNT_HOME%\IdeaProjects\myapp and in order to run it I must manually copy it to my Tomcat webapps. Is there any way to do that automatically?

2) How I start in web browser the current jsp page I edit?
I saw in Run/Debug Configurations the startup browser option but it is not easy to do a configuration for each page I have.....


So in common I need to write code, be in the right directory (%TOMCAT_HOME%\webapps), and when I push run to load my default browser with that page. Can this done ?


I use windows XP

I read the help but does not help me more...

Thanks

6 comments
Comment actions Permalink

Hello jfriend,

Hi

I try to write some JSP code with IntelliJ. So I start a new project
and I choose web module and Tomcat as AS (all other stuffs I let with
default values %MY_ACCOUNT_HOME%\IdeaProjects\myapp).

and I config Run/Debug Configurations > Tomcat server

My problems are:

1) My code is %MY_ACCOUNT_HOME%\IdeaProjects\myapp and in order to run
it I must manually copy it to my Tomcat webapps. Is there any way to
do that automatically?


IDEA should automatically run Tomcat server and deploy your application on
it when you invoke 'Run' action.

2) How I start in web browser the current jsp page I edit?


You can use 'Open in Browser' item from the context menu for your jsp file.

I saw in Run/Debug Configurations the startup browser option but it is
not easy to do a configuration for each page I have.....

So in common I need to write code, be in the right directory
(%TOMCAT_HOME%\webapps), and when I push run to load my default
browser with that page. Can this done ?

I use windows XP

I read the help but does not help me more...

Thanks



0
Comment actions Permalink

Hi again

>IDEA should automatically run Tomcat server and deploy your application on
>it when you invoke 'Run' action

The problem still exists. None of my files have copied to %TOMCAT_HOME%\webapps (my tomcat starts). I must do any configurations ?

I must create my project inside %TOMCAT_HOME%\webapps?

>>You can use 'Open in Browser' item from the context menu for your jsp file

There is not such option in my menu (right click in my JSP file)



I don’t understand why it is too complicate. It must be:

1) Create your project
2) Specify your webapps dir (Tomcat configuration)
3) Compile
4) Deploy (put your files automatically) in webapps\myproject_name
5) Run http://myIp/myproject_name/current_file_i_edit.jsp



Thanks

0
Comment actions Permalink

>> IDEA should automatically run Tomcat server and deploy your application on
>> it when you invoke 'Run' action


The problem still exists. None of my files have copied to %TOMCAT_HOME%\webapps (my tomcat starts). I must do any configurations ?


IDEA creates its own Tomcat environment inside the system directory and
runs Tomcat from there, so don't look into %TOMCAT_HOME%\webapps.

>>> You can use 'Open in Browser' item from the context menu for your jsp file


There is not such option in my menu (right click in my JSP file)


You have to create a Tomcat run configuration (Run -> Edit
Configurations -> Add New Configuration (+-Icon) -> Tomcat Server ->
Local) and there you'll find this option.

I don’t understand why it is too complicate. It must be:


It's not complicated, you just have to get used to it. I'm pretty sure I
would be able to create a hello world web application from scratch
within less than two minutes.

--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

Hello jfriend,

Hi again

>> IDEA should automatically run Tomcat server and deploy your
>> application on it when you invoke 'Run' action
>>

The problem still exists. None of my files have copied to
%TOMCAT_HOME%\webapps (my tomcat starts). I must do any configurations
?

I must create my project inside %TOMCAT_HOME%\webapps?


No. IDEA don't copy your files to %TOMCAT_HOME%\webapps. Instead of this
IDEA runs Tomcat server in such a way that your application will be deployed
without copying to %TOMCAT_HOME%\webapps.


>>> You can use 'Open in Browser' item from the context menu for your
>>> jsp file
>>>

There is not such option in my menu (right click in my JSP file)


This feature is available only in EAP for IDEA 6.0. In IDEA 5.x you should
directly specify url of jsp file in your browser instead.

I don't understand why it is too complicate. It must be:

1) Create your project
2) Specify your webapps dir (Tomcat configuration)
3) Compile
4) Deploy (put your files automatically) in webapps\myproject_name
5) Run http://myIp/myproject_name/current_file_i_edit.jsp
Thanks



0
Comment actions Permalink

Hi Nikolay und Martin

>IDEA creates its own Tomcat environment inside the system directory and
>runs Tomcat from there, so don't look into %TOMCAT_HOME%\webapps.


>No. IDEA don't copy your files to %TOMCAT_HOME%\webapps. Instead of this
>IDEA runs Tomcat server in such a way that your application will be deployed
>without copying to %TOMCAT_HOME%\webapps.

This functionality seems not to working in my PC. Tomcat says that it does not find the file.
Anyway, I solve the problem by creating the exploited directory under %TOMCAT_HOME%\webapps.
So now I have what I need, my application sources to my project directory and the “executable” files under tomcat webapps


>>> You can use 'Open in Browser' item from the context menu for your jsp file


There is not such option in my menu (right click in my JSP file)


>>You have to create a Tomcat run configuration (Run -> Edit
>>Configurations -> Add New Configuration (+-Icon) -> Tomcat Server ->
>>Local) and there you'll find this option.

Yeap I know about that, but I have the notion that I can choose a JSP file and right click it in order to appear an “Open in Browser” option. (But that it is not available - The answer is below)


>This feature is available only in EAP for IDEA 6.0. In IDEA 5.x you should
>directly specify url of jsp file in your browser instead.

Not supporting this feature is a bit of cruel for development. Imagine web applications with 1000+ files with very deep nesting (and people like me that hate mouse) that they must each time to provide the full URL

So my last question is if exist a global environment variable in order to identify the current file I edit:

$/$ in order in “Open in Browser” option to provide something like this: htp://myIP/$/$

If not I think that the development team should provide this functionality!!!!!!!!!! (Intellij is really advanced to lack this functionality)


Thanks
A keyboard maniac developer
jfriend

0
Comment actions Permalink

Hello jfriend,

>> This feature is available only in EAP for IDEA 6.0. In IDEA 5.x you
>> should directly specify url of jsp file in your browser instead.
>>

Not supporting this feature is a bit of cruel for development. Imagine
web applications with 1000+ files with very deep nesting (and people
like me that hate mouse) that they must each time to provide the full
URL

So my last question is if exist a global environment variable in order
to identify the current file I edit:

$/$ in order in "Open in Browser" option to provide > something like this: > > htp://myIP/$/$

If not I think that the development team should provide this
functionality!!!!!!!!!! (Intellij is really advanced to lack this
functionality)


You can create an external tool to open jsp in browser. Go to Settings |
External Tools, click "Add",
specify name and group, set "Program" field (i.e. "C:\Program Files\Mozilla
Firefox\firefox.exe") and "Parameters" field
(i.e. http://localhost:8080/$/FilePathRelativeToProjectRoot$). After that
you can invoke the created tool from Main Menu | Tools | Your group name
| Tool name or define shortcut for this tool in Settings | Keymap.

Thanks
A keyboard maniac developer
jfriend



0

Please sign in to leave a comment.