我是一个刚接触编程的大学毕业生,现在刚用gwt写了一些网页,有一些问题解决不了,想请教各位大虾:
1.怎样设置一个button的超级链接。
2.为什么我写的网页在主机模式下运行正常,可是我用www文件夹里的.html打开时却无法实现网页之间的通信,也就是server文件夹里的java程序无法运行。
真诚想和各位前辈交个朋友。
1.怎样设置一个button的超级链接。
2.为什么我写的网页在主机模式下运行正常,可是我用www文件夹里的.html打开时却无法实现网页之间的通信,也就是server文件夹里的java程序无法运行。
真诚想和各位前辈交个朋友。
1.button,让它submit的action做一个forward,指向一个网页,这样算不算一种超链?
2.你直接打开html,和server通信应该是和本地文件与本地文件交流一样,没能经过容器,那么里面的java代码就没有被解释,所以无法运行..不知道我这么说的对不对...
* Copyright 2007 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package cn.edu.tsinghua.ee.HCI.client;import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBoxBase;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;public class Result extends Sink implements ClickListener { private static Traffic hostTraffic;
public static SinkInfo init(Traffic host) {
hostTraffic = host;
return new SinkInfo(
"显示结果",
"<h2>按需回答原型系统示例演示</h2>"
+ "<p>欢迎使用我的城市交通百事通</p>"
+ "<p>以下是您的全部选择</p>") { public Sink createInstance() {
return new Result();
} public String getColor() {
return "#bf2a2a";
}
};
}
private final TrafficSurveyServiceAsync trafficService;
private Button nextButton = new Button("下一步", this);
private Button prevButton = new Button("上一步", this);
private Button restartButton = new Button("重新输入", this);
private HTML resultHtml = new HTML(); public Result() {
trafficService = (TrafficSurveyServiceAsync) GWT.create(TrafficSurveyService.class);
ServiceDefTarget target = (ServiceDefTarget) trafficService;
String moduleRelativeURL = GWT.getModuleBaseURL() + "traffic";
System.out.println(moduleRelativeURL);
target.setServiceEntryPoint(moduleRelativeURL); VerticalPanel vp = new VerticalPanel();
vp.setSpacing(8);
vp.add(new HTML("您定制的内容如下:"));
vp.add(resultHtml); HorizontalPanel hp = new HorizontalPanel();
hp.setSpacing(8);
hp.add(prevButton);
hp.add(restartButton);
hp.add(nextButton);
vp.add(hp); initWidget(vp);
vp.setWidth("100%");
} public void onClick(Widget sender) {
if (sender == restartButton) {
hostTraffic.changeSink("用户登录"); } else if (sender == prevButton) {
resultHtml.setText("");
hostTraffic.changeSink("地图信息");
}
else if (sender == nextButton) {
Window.open(clickUrl,"_blank","");
}
} public void onShow() {
trafficService.getResult(new AsyncCallback() {
public void onFailure(Throwable caught) {
resultHtml.setText("系统忙,请稍候再试。");
} public void onSuccess(Object result) {
String ret = (String)result;
resultHtml.setHTML(ret);
} });
}
}
设置点击nextButton就连接到一个新的页面,如果是用Macromedia Dreamweaver 做就是右击button,设置超链接这么简单,但是现在不知道怎么办。
还有一个问题就是我写了几张页面,有一张页面是用来保存数据的(我写的是一个定制过程的页面),最后在一个页面中显示我之前做出的选择,但是现在这个功能实现不了(但是在主机模式下可以,也就是用gwt自带的服务器作为server),总是报错"系统忙,请稍候再试。"
不知道我说清楚了吗???
将图片换成一个buttom的图片就行了
你只要提交到了servlet就会执行的
不过还是要谢谢这位好心人。祝你一切顺利!!!
<input type="button" value=“提交" onclick="javascript:location.href='test.html'">
这样写能看明白不