我只想在 WPF 页面之间切换,但出现上述错误:页面只能将 Window 或 Frame 作为父级。这是我的代码
Imports System.Windows.Forms
Run Code Online (Sandbox Code Playgroud)
公开课第1页
Private Sub btn1_Click(sender As Object, e As RoutedEventArgs) Handles btn1.Click
Try
Dim dd As New Page2
Me.Content = dd
Me.txt1.Text = (dd.txt10.Text)
Catch ex As Exception
txt1.Text = ex.Message
End Try
Run Code Online (Sandbox Code Playgroud)
xaml 文件代码
<Page x:Class="Page2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="Page2">
<Grid>
<Button x:Name="button1" Content="Button" HorizontalAlignment="Left" Margin="163,62,0,0" VerticalAlignment="Top" Width="101" Height="55"/>
<TextBox x:Name="txt10" HorizontalAlignment="Left" Height="23" Margin="38,81,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
请指导我我做错了什么?
我是java的新手,我只是尝试从Deployment Descriptor文件(web.xml)中读取初始化参数,但是出现了上述错误?
我web.xml和java文件编码编码附加快照.
我的直接结构是
c:\....tomcat\webapps\dd\web-inf\classes
Run Code Online (Sandbox Code Playgroud)
java类文件中没有错误.
成功编译的Java文件代码
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyServlet2 extends HttpServlet {
String fileName;
public void init(ServletConfig config) throws ServletException {
super.init(config);
fileName = config.getInitParameter("logfilename");
}
protected void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException {
processRequest(request, response);
}
protected void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException {
processRequest(request, response);
}
protected void processRequest(HttpServletRequest request,HttpServletResponse
response)throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println(fileName);
out.close();
}
}
Run Code Online (Sandbox Code Playgroud)
web.xml中
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app> …Run Code Online (Sandbox Code Playgroud)