开发者

best way to migrate PHP Pages into GWT

I'm looking for a good strategy to migrate a PHP website into GWT front-end based site.

i'm intending to use UIBinder to build the UI for new GWT Pages. The PH开发者_如何转开发P pages have a set of resources (images, js files and css files).

what is a good strategy to follow to convert HTML/CSS UI into UIBinder GWT ?

thanks.


This question's kind of vague. Anything that was a DIV would become a "Panel" of some sort, FlowPanel, HTMLPanel, etc. The CSS can live right alongside the markup in GWT in a UIBinder ui.xml file, inside a block. Not sure what you mean exactly by this question.


I have had a hard time moving a php website over to GWT myself.

Here is what I learned. Firstly I learned that I didn't really want to move everything over to GWT. There is a lot that is hard to move into a GWT project IE bootstrap.

Instead I would recommend using jsp instead for most pages. Jsp is a lot like php and will work with your existing GWT project. Here are a couple links that kind of look at that. https://cloud.google.com/appengine/docs/java/gettingstarted/ui_and_code http://www.gwtproject.org/articles/dynamic_host_page.html

Gwt is best at one page intensive apps and it might be easiest to make everything jsp then move individual pages into GWT.

Anyway here is what I think the easiest way to go about it.
1. Copy your php site into the war folder of your gwt project
2. Rename all of the php files to jsp
If you are using linux here is a command to do that

rename 's/\.php$/\.jsp/' *.php
  1. Go through and change all
<?php to <% and ?> to %> 

My preference is to actually change them to

<!--TODO% and %--> 

If you are using linux here is a command to do that

grep -rl "<?php" *.jsp  | xargs sed -i 's|<?php|<!--TODO%|g'  
grep -rl "?>" *.jsp  | xargs sed -i 's|?>|%-->|g'
  1. Go through and change all of those php sections to java
  2. Go through and convert whatever pages you want to gwt
  3. Update your web.xml file

Cheers, hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜