我正在使用Apache BeeHive.我的JSP包含一个表单(<netui:form>),带有一个下拉框(<netui:select>)和一个提交按钮(<netui:button>).当按下提交按钮时,将提交表单的默认操作("doAction1").当从下拉列表中选择一个选项时,我想要提交 不同的操作("doAction2"). (参见图1).
我的第一个倾向是创建一个JavaScript函数,将表单的action属性更改为新的操作名称,然后提交表单(参见图2),但这不起作用.我发现标签将"doAction1"翻译为完整的URL http://localhost:7001/app/doAction1.do.
我传递给JavaScript submitForm(form,newAction)方法的"doAction2"字符串无法将"doAction2"转换为适当的URL(它可以,但只能以kludgey方式).我去寻找一个可以将普通动作名称转换为URL的netui标签,但我找不到一个.
那么,实现这一目标的正确方法是什么?
图1 - JSP代码片段
<netui:form action="doAction1" method="post">
<netui:select dataSource="actionForm.field1"
optionsDataSource="${actionForm.field1Selections}"
onChange="submitForm(this.form, 'doAction2')"/>
<p/>
<netui:button>Submit</netui:button>
</netui:form>
Run Code Online (Sandbox Code Playgroud)
图2 - 用于更改表单操作和提交表单的JavaScript函数
<netui:scriptBlock placement="before">
function submitForm(form, newAction) {
form.action = newAction;
form.submit();
}
</netui:scriptBlock>
Run Code Online (Sandbox Code Playgroud) 我有一个TClientDataSet由TTable数据集提供的.数据集有两个字段:邮政编码(字符串,5)和街道(字符串,20)
在运行时,我想显示第三个字段(字符串,20).该字段的例程是将邮政编码作为参数并将该城市归属于该邮政编码.
问题只是将计算字段添加到现有字段中.填充数据本身不是问题.
我试过了:
cds.SetProvider(Table1);
cds.FieldDefs.Add('city', ftString, 20);
cds.Open;
cds.Edit;
cds.FieldByName('city').AsString := 'Test'; // --> errormessage (field not found)
cds.Post;
Run Code Online (Sandbox Code Playgroud)
cds是我的clientdataset,Table1是一个悖论表,但问题与其他数据库相同.
提前致谢
为同一域上的URL创建短URL服务时,我们是否应该使用302重定向?
完整的URL结构:example.com/gig/{id}/gig-full-name-slug
短网址结构:example.com/g/{base64id}
我们正在使用asp.net mvc3,如果有任何快捷方式的话.
当我尝试在if语句中提取一个方法时,我正面临这个问题.我无法找到任何报告的错误.
procedure TForm1.BitBtn3Click(Sender: TObject);
var
x: integer;
b: boolean;
begin
if true then
x := 8 //********************** i try to extract this line
else
x := 6;
showmessage(inttostr(x));
end;
Run Code Online (Sandbox Code Playgroud)
我得到的结果是:
procedure TForm1.BitBtn3Click(Sender: TObject);
var
x: integer;
b: boolean;
begin
if true then
newMethode
else
x := 6;
showmessage(inttostr(x));
end;
Run Code Online (Sandbox Code Playgroud)
而新的Methode是:
procedure TForm1.newMethode;
var
x: Integer;
begin
x := 8;
end;
Run Code Online (Sandbox Code Playgroud)
任何人都可以检查Delphi XE上的行为是什么?有谁知道是否有报道?
我是datomic的新手,我还在试图弄清楚系统是如何构建的.特别是,我不明白什么角色:db.part/db播放,因为每次安装架构时似乎都需要它.有人可以说明这一切意味着什么吗?
(require '[datomic.api :as d])
(def uri "datomic:mem://sample")
(d/create-database uri)
(def conn (d/connect uri))
(pprint (seq (d/entity dbval :db.part/db)))
;; =>
;; ([:db/doc "Name of the system partition. The system partition includes the core of datomic, as well as user schemas: type definitions, attribute definitions, partition definitions, and data function definitions."]
;; [:db.install/function #{:db.fn/cas :db.fn/retractEntity}]
;; [:db.install/attribute
;; #{:db/noHistory :db.install/partition :db/cardinality
;; :db.install/attribute :db/index :db/unique :db/fulltext
;; :db/txInstant :db/lang :db/doc :db.install/valueType :db/code
;; :db/isComponent :db/fn :db.install/function :db/valueType :db/ident
;; :fressian/tag}] … 我需要提取a中找到的第一个整数,java.lang.String并且不确定是否尝试使用substring方法或正则表达式方法:
// Want to extract the 510 into an int.
String extract = "PowerFactor510";
// Either:
int num = Integer.valueof(extract.substring(???));
// Or a regex solution, something like:
String regex = "\\d+";
Matcher matcher = new Matcher(regex);
int num = matcher.find(extract);
Run Code Online (Sandbox Code Playgroud)
所以我问:
注意:字符串将始终以单词PowerFactor后跟非负整数开头.提前致谢!
我正在尝试编写一个内核模块,它将一些数据写入proc文件.我正在尝试编写类似于5000个字符的内容,但当我说$> cat/proc/myentry时,我只能读取1000个字符.
int procfile_read(char *buffer, char **buffer_location, off_t offset, int buffer_length, int *eof, void *data){
int ret;
static char my_buffer[4096];
if (offset > 0) {
ret = 0;
} else {
ret = sprintf(my_buffer, LARGE STRING HERE);
}
*buffer_location=my_buffer;
return ret;
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码.提前致谢.
我在服务中有一个线程,我希望能够在我按下buttonStop主活动类时停止该线程.
在我的主要活动课中,我有:
public class MainActivity extends Activity implements OnClickListener {
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
buttonStart = (Button) findViewById(R.id.buttonStart);
buttonStop = (Button) findViewById(R.id.buttonStop);
buttonStart.setOnClickListener(this);
buttonStop.setOnClickListener(this);
}
public void onClick(View src) {
switch (src.getId()) {
case R.id.buttonStart:
startService(new Intent(this, MyService.class));
break;
case R.id.buttonStop:
stopService(new Intent(this, MyService.class));
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
在我的服务课上,我有:
public class MyService extends Service {
...
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
int icon = …Run Code Online (Sandbox Code Playgroud) 我有一个函数声明,在数据类型之后包含一个questionmark,如:
private TimeSpan? sometime()
{
}
Run Code Online (Sandbox Code Playgroud)
这是什么意思?
我正在DataGridView使用从实体框架获取的列表来显示一些数据。在此网格中,我将一些数据库列(如)设置id为invisible。
当用户单击gridview时,我需要知道单击了哪个对象以进行进一步的步骤,但我无法id通过以下方式获取该列的问题:
datagridview1.CurrentRow.Cells[0].Value // here I get only visible cells
Run Code Online (Sandbox Code Playgroud)
也不通过:
datagridview1.CurrentRow.DataBoundItem
Run Code Online (Sandbox Code Playgroud)
似乎通过设置一些列使其不可见,附加的对象具有匿名类型
有任何想法吗?
谢谢
c# ×3
delphi ×2
java ×2
.net-4.0 ×1
android ×1
beehive ×1
clojure ×1
database ×1
datagridview ×1
dataset ×1
datomic ×1
delphi-2010 ×1
iis-7 ×1
kernel ×1
linux ×1
module ×1
netui ×1
nullable ×1
procfs ×1
redirect ×1
refactoring ×1
regex ×1
service ×1
short-url ×1
string ×1
syntax ×1
winforms ×1