tags:

views:

43

answers:

2

I need some help figuring out how to make some changes to some .jsp pages that are contained inside of a .war package.

I am using jbilling opensource billing software and need to modify some elements/display and want to do it directly in the .jsp, so I unpacked the .war file and made a change, then packaged it back up and put it inside the webapps folder and restarted tomcat. But I noticed the filesize from the .war that I packaged was smaller than the original .war and it should have been larger because I added stuff to it. Needless to say, tomcat didn't start up properly, or at least there were errors in the logs..but they didn't help me and jbilling didn't work right. I reverted back to the orignal .war and it worked fine.

Is it possible for me to unpackage a .war and simply make some html changes, then repackage it up without having to recompile the whole source code with the java classes? Did I use the wronge "packaging" tool to compile it? Is there another way to accomplish what I'm trying to?

I did this in a FreeBSD box with using the following commands: unpackage-->sudo jar cf ../billing.war * repackage-->sudo jar -xvf billing.war

Thanks for your help.

+2  A: 

You can simply open war file using archiver utility (seems you are using ubuntu).

Open jsp file from archiver util it self , make changes , and Archiver util will ask that jsp file has been modified you want to update your war file say yes there.

Note: If you are going to do only view changes than go for this tricky way otherwise if you are willing to change source java files than building the war will be strongly recommended

org.life.java
+1  A: 

Moreover, .WAR and .JAR (AFAIK all it goes for all .*AR) are basically glorified zip files conforming to some structural requirements (manifests, web app descriptors, etc.). The easiest way to do the changes you want are to handle the .WAR file as if it was a plain-simple ZIP file. The choice of the tools is all yours (archiver, pkzip, etc.).

vstoyanov
Ok, I have 7-zip, and IZarch for compressing files, but neither of them give me the option to compress to a .war, but Izarch does give me the option for .jar, does it matter?...when on the freebsd box can I just change the extension to .war and have it work?
Ronedog
It doesn't matter at all .WAR is only an extension. Think of it as a .ZIP file that has only the extension changed, while still being just an ordinary ZIP file.BTW, the same applies for a bunch of other formats such as the firefox extensions one, the new MS formats *.docx/xslx/etc
vstoyanov
Ok, I extracted the .war and made a small change to a .jsp, then compressed it to a .tar...all this done on windows vista with IZARC, then i ftp'd it over to the freebsd box and changed the extension to .war. Then restarted tomcat. But the page wouldn't load. When starting to deploy the .war the error log shows `java.lang.IllegalArgumentException: Invalid or unreadable WAR file`. Is there a problem with modifying in a windows environment, then copying the way I did?
Ronedog
TAR is not ZIP. You should compress it back to a ZIP file and then change the extension.
vstoyanov
thanks for the clarification. using .zip worked! Thanks for your help.
Ronedog