我必须到学校的项目,我必须建立一个asp.net(4)网站,我需要从会话变量中获取一个值,并将其存储在文本框或标签中.我已经尝试过使用文本框直到现在........然后我卡住了.
我的会话变量声明在Default.aspx页面上:
Session["user"] = username;
Run Code Online (Sandbox Code Playgroud)
我在Home.aspx页面上的文本框代码:
<div class="content"><!--D2-->
<form id="form1" runat="server">
<div class="logged"><!--D3-->
<p class="i_am">You are logged in as:<asp:TextBox ID="txt_loggedas" runat="server" ></asp:TextBox>
</p>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LogOut">[Log Out]</asp:LinkButton>
Run Code Online (Sandbox Code Playgroud)
我试过这个链接的答案:如何在ASP文本框中显示会话值,但我没有成功x-(
我有一个有效负载返回以下内容ArrayList:
[0] true (boolean)
[1] "someStringValue"
Run Code Online (Sandbox Code Playgroud)
我需要String使用lambda表达式提取包含该值的元素的值.
有任何想法吗?
我想在Motor类中创建一个构造函数(Motor),我想在Contructor1类中调用它,但是当我这样做时我有一个错误.....我不知道为什么.我刚刚从本周开始学习java.
这是代码:
class Motor{
Motor(int type[]){
int input;
input=0;
type = new int[4];
for(int contor=0; contor<4; contor++){
System.out.println("Ininsert the number of cylinders:");
Scanner stdin = new Scanner(System.in);
input = stdin.nextInt();
type[contor] = input;
System.out.println("Motor with "+type[contor]+" cylinders.");
}
}
}
public class Contructor1 {
public static void main(String[] args){
Motor motor_type;
for(int con=0; con<4; con++){
motor_type = new Motor();
}
}
}
Run Code Online (Sandbox Code Playgroud)