gpt4 book ai didi

java - Tomcat 显示空白页 - GWT devmode 工作正常

转载 作者:行者123 更新时间:2023-11-28 22:21:07 25 4
gpt4 key购买 nike

我正在 eclipse 上开发一个 GWT 项目,当我运行开发模式时一切正常。但是当我在我的 tomcat 服务器上部署 WAR 文件(按照本指南 click 生成)时,http://localhost:8080/myproj/ 只显示一个空白页。我尝试将 Window.alert("..") 添加为 onModuleLoad() 方法中的第一行,它确实显示正确。清除浏览器缓存是没有用的。服务器启动执行时没有问题也没有异常。我应该怎么做才能解决这个问题?

这是我的入口类

public class Segnalazioni_Degrado implements EntryPoint {

protected static List<Macrocategoria> listaMacrocategorie;
protected static List<Segnalazione> segnalazioniAttiveCached = new ArrayList<Segnalazione>();
protected static List<SegnalazioneRisolta> segnalazioniRisolteCached = new ArrayList<SegnalazioneRisolta>();

protected static final DataLayerServiceAsync dataLayerService = GWT
.create(DataLayerService.class);
protected static final LoginServiceAsync loginService = GWT
.create(LoginService.class);
protected static final MailServiceAsync mailService = GWT
.create(MailService.class);

protected static Properties props;
private final String TITOLO = "PORTALE SEGNALAZIONI DEGRADO";

private LatLng romaLatLng;

private DockLayoutPanel mainPnl;

private HorizontalPanel northPnl;
private HorizontalPanel southPnl;
private VerticalPanel westPnl;
private AbsolutePanel centerPnl;

protected static StatsPanel statsPnl;
protected static MenuPanel menuPnl;
protected static LoginPanel loginPnl;
protected static LegendPanel legendPnl;

protected static MapWidget map;
private Label titoloLbl;
private/* Button */FocusWidget areaRiservataBtn;
private Button followUsOnTwitterBtn;
private HTML mailto;

/**
* TODO tweet segnalazione inserita o risolta, porta su .css tutto il
* possibile, prendi tutto da config, fai log su server, crea mail, leggenda
* icone, elimina file foto non solo link
*/

public void onModuleLoad() {
loadProps();
buildUI();
}

void loadProps() {
props.set("scarsa manutenzione manto stradale", "images/red.png");
props.set("veicolo abbandonato", "images/red.png");
props.set("discarica abusiva", "images/green.png");
props.set("accumulo spazzatura", "images/green.png");
}

void buildUI() {
Maps.loadMapsApi("", "2", false, new Runnable() {
public void run() {
buildHomePage();
}
});
}

private void buildHomePage() {

mainPnl = new DockLayoutPanel(Unit.PCT);
mainPnl.setStyleName("mainPanel");
northPnl = new HorizontalPanel();
northPnl.setStyleName("northPanel");
southPnl = new HorizontalPanel();
southPnl.setStyleName("southPanel");
westPnl = new VerticalPanel();
westPnl.setStyleName("westPanel");
centerPnl = new AbsolutePanel();
centerPnl.setStyleName("centerPnl");

loginPnl = new LoginPanel();
statsPnl = new StatsPanel();
menuPnl = new MenuPanel();

Segnalazioni_Degrado.dataLayerService
.getListaMacrocategorie(new AsyncCallback<List<Macrocategoria>>() {

@Override
public void onFailure(Throwable caught) {
caught.printStackTrace();
}

@Override
public void onSuccess(List<Macrocategoria> result) {

Segnalazioni_Degrado.listaMacrocategorie = result;
centerPnl.add(new LegendPanel());
}

});


/**
* costruisco la Google Map
*/
Size mapSize = Size.newInstance(500, 500);
MapOptions mapOpts = MapOptions.newInstance();
mapOpts.setSize(mapSize);
romaLatLng = LatLng.newInstance(41.8902624, 12.4923096);
map = new MapWidget(romaLatLng, 12, mapOpts);
map.checkResizeAndCenter();
map.setSize("99%", "99%");
map.addControl(new LargeMapControl());
map.setDoubleClickZoom(true);
map.setScrollWheelZoomEnabled(true);
map.setStyleName("map");

/**
* costruisco il titolo del portale
*/
titoloLbl = new Label(TITOLO);
titoloLbl.setStyleName("titolo");

/**
* costruisco bottone per accedere ad area riservata
*/
/* areaRiservataBtn = new Button("Accedi all'area riservata"); */
areaRiservataBtn = new Button("AREA RISERVATA");
areaRiservataBtn.setStyleName("bottomBtn");
areaRiservataBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
new AreaRiservataDialog();
}
});

/**
* costruisco bottone twitter
*/

followUsOnTwitterBtn = new Button();

followUsOnTwitterBtn.addStyleName("bottomBtn");
followUsOnTwitterBtn.addStyleName("twitter");


followUsOnTwitterBtn
.getElement()
.appendChild(
new HTML(
"<div><img src=images/twitter.gif><b>segui @stop_degrado</b></div>")
.getElement());
followUsOnTwitterBtn.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
Window.open("https://twitter.com/stop_degrado", "_blank", "");
}

});

/**
* costruisco bottone mailto
*/
mailto = new HTML("<a href=mailto:dummy@fake.foo> Contattaci </a>");
mailto.setStyleName("bottomBtn");

/**
* creo bottone ABOUT US
*/
Button aboutus = new Button("ABOUT US");
aboutus.setStyleName("bottomBtn");
aboutus.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
new AboutUsPopup();
}

});



northPnl.add(titoloLbl);
northPnl.add(loginPnl);

westPnl.add(menuPnl);

westPnl.add(statsPnl);

southPnl.add(followUsOnTwitterBtn);
southPnl.add(aboutus);
southPnl.add(areaRiservataBtn);
southPnl.add(mailto);

centerPnl.add(map);


mainPnl.addNorth(northPnl, 8);
mainPnl.addWest(westPnl, 30);
mainPnl.addSouth(southPnl, 3.5);
mainPnl.add(centerPnl);

RootLayoutPanel.get().add(mainPnl);

MenuPanel.refreshBtn.click();

}
}

最佳答案

我认为它是一个NullPointer:

protected static Properties props; // << NULL

public void onModuleLoad() {
loadProps(); // props is still NULL
buildUI();
}

void loadProps() {
// props is still NULL
props.set("scarsa manutenzione manto stradale", "images/red.png"); // BANG!
[...]

顺便说一句:为什么将 props 设为静态?您只有一个 EntryPoint 实例。因此无法共享任何状态。

关于java - Tomcat 显示空白页 - GWT devmode 工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18677558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com