我有这个GSP:
<g:uploadForm name="myForm" action='save'>
<input type='file' name='documentFile' value=''/>
<input type='file' name='documentFile' value=''/>
<input type='file' name='documentFile' value=''/>
<input type='file' name='documentFile' value=''/>
<input type='submit' value='Submit'/>
</g:uploadForm>
Run Code Online (Sandbox Code Playgroud)
但是当我尝试通过键入以下内容来查看控制器中的结果时:
render(params);
return true;
Run Code Online (Sandbox Code Playgroud)
我得到了这个结果:
"documentFile":org.springframework.web.multipart.commons.CommonsMultipartFile@14dcf95
Run Code Online (Sandbox Code Playgroud)
如何阅读正在上传的每个文件?我可以得到以下内容吗?
documentFile:[File,null,File,null] // (if the 2nd and the 4th are not being used)
Run Code Online (Sandbox Code Playgroud)
ps:我正在使用grails 1.2.2
我有一个用于编辑用户的页面,里面有一些子组件.每个子组件都可以更改或对其父组件执行某些操作.
因此,我没有将更改发送到父级并更新某些字段,而是使用"重新加载"当前页面
private route: ActivatedRoute;
reload(){
this.router.navigate(["/admin/user/edit/"+this.user.id]);
}
Run Code Online (Sandbox Code Playgroud)
基本上,它重定向到当前页面.例如,当前页面是 http://web.info/admin/user/edit/9,它将被重定向到此页面,希望该页面内的所有数据都重新加载最新数据.
但似乎角度不会重定向/重新加载相同的页面 router.navigate
我该如何重新加载当前页面?
编辑:
这就是我需要重新加载页面而不是手动更新当前页面上的数据的原因.我需要对其他组件进行更新,当我进行更新时,它会向History Component添加一些内容.我需要一起刷新用户组件和历史组件,因为两个组件都受到其他组件中的更改的影响.
我有一个包含像这样的多文件上传的表单
<g:form name="legalActionForm" controller="legalAction" action="save" enctype="multipart/form-data">
<input type='file' name='documentFile'/> <input type='text' name='documentDate'/>
<input type='file' name='documentFile'/> <input type='text' name='documentDate'/>
<input type='file' name='documentFile'/> <input type='text' name='documentDate'/>
<input type='file' name='documentFile'/> <input type='text' name='documentDate'/>
<input type='file' name='documentFile'/> <input type='text' name='documentDate'/>
<input type='submit' value='update'/>
</g:form>
Run Code Online (Sandbox Code Playgroud)
如果需要,用户可以添加更多...如何使用迭代器获取每个文件?
如果我只使用一个文件,request.getFile('documentFile');
但如果我尝试过,request.getFileNames().each{obj -> println("${obj}"); } 我只得到第一个...
我想将角度4从asp.net core2升级到角度5(最新的一个)
我做了这个步骤:
npm install @ angular/animations @ latest @ angular/common @ latest @ angular/compiler-cli @ latest @ angular/core @ latest @ angular/forms @ latest @ angular/http @ latest @ angular/platform -browser @ latest @ angular/platform-browser-dynamic @ latest @ angular/platform-server @ latest @ angular/router @ latest rxjs @ latest --save
npm install typescript@2.4.2 --save-exact
npm install(确保)
dotnet运行
它会产生错误:( @ angular/compiler-cli的版本需要为2.3.1或更高版本.当前版本为"5.1.0".)我不知道如何修复它.
我的package.json
{
"name": "MyApp",
"private": true,
"version": "0.0.0",
"scripts": {
"test": "karma start ClientApp/test/karma.conf.js"
},
"devDependencies": {
"@angular/animations": "^5.1.0", …Run Code Online (Sandbox Code Playgroud) 我有一个模型:
用户
public class User {
public int Id { get; set; }
public string UserName {get; set;}
...
public int? ManagerId {get; set;}
public User Manager {get; set;}
public int? SupervisorId {get; set;}
public User Supervisor {get; set;}
..
}
Run Code Online (Sandbox Code Playgroud)
我检查了我的 MySQL Db,发现 ManagerId 是唯一的。我没有将其设置为唯一。现在我想使用 dotnet ef 迁移删除它。怎么做 ?
我现在使用 donet core 2.1。
我已经测试删除 ManagerID 和 Manager 并执行 dotnet ef 迁移添加 UpdateUser
检查并删除 ManagerID。然后我尝试再次添加新名称AssignedManagerID,它创建了一个新名称,且unique为true。
migrationBuilder.CreateIndex(
name: "IX_Users_AssignedManagerId",
table: "Users",
column: "AssignedManagerId",
unique: true);
Run Code Online (Sandbox Code Playgroud)
我的 Datacontext:公共 DbSet 用户 {get; 放;} …
我有一个数据库表来连接用户和客户端之间的数据。
db: class UserClientCorporate{
int UserId;
User User;
int ClientCorporateId;
ClientCorporate ClientCorporate;
}
Run Code Online (Sandbox Code Playgroud)
我想查询以获取ClientCorporates分组的列表userid。我在 LINQ 中遵循了诸如Group by 之类的 Stack Overflow 上的一些示例
这是我的查询:
var data3 = from db in _context.UserClientCorporate
group db.ClientCorporateId by db.UserId into g
select new { UserId = g.Key, Clients = g.ToList() };
return Ok(await data3.ToListAsync());
Run Code Online (Sandbox Code Playgroud)
当我运行这个时,我得到了错误:
失败:Microsoft.AspNetCore.Server.Kestrel[13] 连接 ID“0HLT67LJQA4IP”,请求 ID“0HLT67LJQA4IP:0000000F”:应用程序引发了未处理的异常。System.InvalidOperationException: 无法翻译 LINQ 表达式“ToList(GroupByShaperExpression: KeySelector: u.UserId, ElementSelector:ProjectionBindingExpression: EmptyProjectionMember)”。以可翻译的形式重写查询,或通过插入对 AsEnumerable()、AsAsyncEnumerable()、ToList() 或 ToListAsync() 的调用显式切换到客户端评估。有关详细信息,请参阅https://go.microsoft.com/fwlink/?linkid=2101038。
如何解决这个问题呢?
解决了 !在我做了更多研究之后,似乎 EF Core 在数据库服务器上执行此查询有限制。所以我需要先获取数据并在我的 …
我想为我现在开发的网站增加价值,以便用户可以查看他们的手机.
我的问题:
我应该为移动版和完整版一个制作不同的模板吗?就像为移动版创建mobile.example.com一样?
Opera Mini不支持JavaScript吗?我有一部装有Opera Mini的手机,似乎JavaScript没有运行.所有Opera Mini都没有JavaScript吗?
Opera Mini是否支持完整的W3C标准HTML和CSS?或者他们有不同的?
是否有任何模拟器可以在不同的手机上查看或测试网站?例如:Iphone浏览器,Blackberry浏览器,WAP和Opera Mini.
谢谢!!!
我的 web api 应用程序中出现奇怪的错误:在上一个操作完成之前,在此上下文中启动了第二个操作。不保证任何实例成员都是线程安全的。
我有一个过程来计算用户的发薪日并更新其用户休假余额。所以我需要迭代用户并获取其休假余额,然后对每个余额进行更新。我还不知道如何解决这个错误。当我调用包含的 this.SaveAll() 时触发的错误
public async Task<bool> SaveAll()
{
return await _context.SaveChangesAsync() > 0;
}
Run Code Online (Sandbox Code Playgroud)
数据上下文也被注入了这个代码:
private readonly DataContext _context;
private readonly IAdminSettingsRepository _settingRepo;
private readonly IAppRepository _appRepository;
public PayrollRepository(DataContext context, IAdminSettingsRepository settingRepo, IAppRepository appRepository)
{
_context = context;
_settingRepo = settingRepo;
_appRepository = appRepository;
}
Run Code Online (Sandbox Code Playgroud)
流程如下:
public async Task<bool> ProcessPayCalendar(PayCalendar payCalendar)
{
List<User> users = payCalendar.Users.ToList();
SickLeaveEntitlement sickLeaveEntitlement = await _settingRepo.GetSickLeaveEntitlement();
AnnualLeaveEntitlement annualLeaveEntitlement = await _settingRepo.GetAnnualLeaveEntitlement();
LongServiceLeaveEntitlement longServiceLeaveEntitlement = await _settingRepo.GetLongServiceLeaveEntitlement();
DateTime tenYearsAgo = DateTime.Today.AddYears(-10);
DateTime …Run Code Online (Sandbox Code Playgroud) I am using Dotnet Core 2.2 to generate report with JSReport (https://jsreport.net/) I use local JsReport so I sent my template and data to the local server and get back the pdf. Now I need to format date in javascript, so I require to include moment.js into my templates. I have no idea how to do that.
In html I need to format StartDate to formated Date using moment.js I have no idea how to include moment.js into …
嗨,我有一个像下面这么简单的域名
// page 52 Bankruptcy Questions
class FamilyLawFinancial{
Date dateOfTheOrder ;
boolean isPartyToFamilyLawProperty = false;
boolean isCurrentlyInvolvedInFamilyLawProperty = false;
boolean isBecomeInvolvedInProceedings = false;
static belongsTo=[person:Person];
static constraints = {
dateOfTheOrder(nullable:true);
isPartyToFamilyLawProperty(nullable:false);
isCurrentlyInvolvedInFamilyLawProperty(nullable:false);
isBecomeInvolvedInProceedings(nullable:false);
}
String toString(){
"${id}"
}
}
Run Code Online (Sandbox Code Playgroud)
这是保存数据的控制器:
def save = {
def person = Person.get(session.curperson.id);
def obj = FamilyLawFinancial.findByPerson(person);
if(obj == null){
obj = new FamilyLawFinancial();
obj.person = person ;
}
params.dateOfTheOrder = myutil.formatDate(params.dateOfTheOrder);
obj.properties = params;
println(obj.hasErrors());
println(obj.dateOfTheOrder);
if(obj.hasErrors() && !obj.save(flush:true)){
println("errors: ${obj.errors}");
flash.message = "error …Run Code Online (Sandbox Code Playgroud) grails ×3
.net ×2
.net-core ×2
angular ×2
asp.net ×2
asp.net-core ×2
c# ×2
file-upload ×2
java ×2
javascript ×2
ef-core-2.1 ×1
ef-core-3.1 ×1
groovy ×1
java-ee ×1
jsreport ×1
mobile ×1
opera-mini ×1