我想index.jsp在 Web 应用程序中运行文件时打开一个新选项卡。我已经使用Show.java(一个 servlet)来执行那个 . 当前情况是,当我单击 中的Print按钮时index.jsp,我想在新选项卡中打开的内容页面显示在当前选项卡上。我想使用 servlet 响应而不是使用javascriptor来做到这一点jquery。
这是我写在index.jsp文件中的,
<form action="Show">
<input type="submit" value="Print"/>
</form>
<%@page import="net.sf.jasperreports.engine.export.JRPdfExporter" %>
<%
JRPdfExporter export = (JRPdfExporter)request.getAttribute("exportIndentObject");
if (export != null){
JRPdfExporter export1 = (JRPdfExporter) session.getAttribute("exportIndentObject");
export1.exportReport();
}%>
Run Code Online (Sandbox Code Playgroud)
这是Show.java我用来保存内容的,
String param ="Terance";
Map<String, Object> map = new HashMap<String, Object>();
map.put("param", param);
JRPdfExporter jRPdfExporter = new JRPdfExporter(); jRPdfExporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT, this.print();");
String jsaperFile="C:\\Users\\user\\Desktop\\Terance\\Jasper\\JasperReport\\src\\java\\jasper\\Report.jrxml";
System.out.println(jsaperFile);
try
{
String report=JasperCompileManager.compileReportToFile(jsaperFile);
File file=new …Run Code Online (Sandbox Code Playgroud) 我有一个JTable具有DefaultTableModel.现在我想更改表列标题和列数据类型(例如: - Boolean,String,Object等).我尝试做如下.
DefaultTableModel model = (DefaultTableModel) list_table.getModel();
list_table.setModel(new javax.swing.table.DefaultTableModel(new Object[][]{}, new String[]{"", "ID", "Name", "Age","Address", "Contact", "Gender", "Civil Status" }));
updateTable();
Run Code Online (Sandbox Code Playgroud)
""列对象类型应该是boolean.But我无法将对象类型更改为布尔值.此外,我在线程环境中运行它.
有任何想法.
我sql在 jasper 报告中有一个查询,我想用括号括起从中生成的特定结果。
这是sql查询,
SELECT `idMedication`,`idPatient`, `Drug` from medication
Run Code Online (Sandbox Code Playgroud)
我想Drug在结果中加一个括号,我需要通过它自己的 SQL 代码来做。
例如,目前一种药物显示为“Paracetamol”,但我要求将其显示为“ (Paracetamol)”
关于如何做到这一点的任何想法?
我有一个TextView,我OnClickListener对此放了一个TextView。我使用此操作将自定义视图加载到LinearLayout。
但是,当我单击TextView两次时,自定义视图在上重复LinearLayout。LinearLayout在将新的自定义视图加载到this 之前,我会清除所有自定义视图LinearLaout。
这是我OnClickListener的TextView,
TextView rejectedTitleTextView = (TextView) findViewById(R.id.roster_menu_rejected_title);
rejectedTitleTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
rejectedTitleTextView.setBackgroundColor(getResources().getColor(R.color.acceptedPurpleColour));
newTitleTextView.setBackgroundColor(getResources().getColor(R.color.defaultBlack));
acceptedTitleTextView.setBackgroundColor(getResources().getColor(R.color.defaultBlack));
locationLinearLayout.removeAllViews();
rosterBottomLayout.setVisibility(View.GONE);
Log.d("CHECK_ACTION"," REJECTED_TEXT_VIEW ");
InternetConnectivity internetConnectivity = new InternetConnectivity();
final boolean isConnectedToInternet = internetConnectivity.isConnectedToInternet(context);
if(isConnectedToInternet==true) {
try {
Thread.sleep(1300);
} catch (Exception e) {
e.printStackTrace();
}
getDataFromServer("REJECTED");
}else{
Snackbar.make(mainView, "No Internet Connection", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
}
}); …Run Code Online (Sandbox Code Playgroud) android textview android-layout android-linearlayout onclicklistener
我使用带有两个按钮的JTable(活动和非活动按钮).当我点击非活动按钮时,我隐藏了表格的第一列.另外,当我点击"活动"按钮时,我会尝试显示第一列.但问题是,当我点击"活动"按钮时,我无法显示第一列的首选大小.
这是隐藏第一列的代码,
expTable.getColumnModel().getColumn(0).setMinWidth(0);
expTable.getColumnModel().getColumn(0).setMaxWidth(0);
expTable.getColumnModel().getColumn(0).setWidth(0);
Run Code Online (Sandbox Code Playgroud)
这是获取拳头栏的代码,
expTable.getColumnModel().getColumn(0).setMinWidth(0);
expTable.getColumnModel().getColumn(0).setMaxWidth(300);
expTable.getColumnModel().getColumn(0).setWidth(100);
Run Code Online (Sandbox Code Playgroud)
首先,我单击"非活动"按钮,然后单击"活动"按钮.但这不起作用.
有任何想法如何做以上.
private void inactiveButtonActionPerformed(java.awt.event.ActionEvent evt){
expTable.getColumnModel().getColumn(0).setMinWidth(0);
expTable.getColumnModel().getColumn(0).setMaxWidth(0);
expTable.getColumnModel().getColumn(0).setWidth(0);
}
private void activeButtonActionPerformed(java.awt.event.ActionEvent evt)
{
expTable.getColumnModel().getColumn(0).setMinWidth(0);
expTable.getColumnModel().getColumn(0).setMaxWidth(300);
expTable.getColumnModel().getColumn(0).setWidth(100);
}
Run Code Online (Sandbox Code Playgroud) 我有三个数字(25、30 和 35)。我想从这三个数字中得到一个随机数。
我知道如何从一个范围内获得一个随机数,但在这种情况下,我不知道如何(随机)获得这三个数字之一。
有谁有想法吗?
谢谢你。
我有一个LinearLayout,我想为它设置边框.它应该如下所示.
这是我的布局,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".activities.AddInfoMainActivity"
tools:showIn="@layout/app_bar_main">
<LinearLayout
android:id="@+id/add_info_layout_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/add_info_layout_one_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/add_info_layout_one_img01"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="24dp"
android:src="@drawable/sample01" />
<TextView
android:id="@+id/add_info_layout_one_txtView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/add_info_txt_one_01"
android:textAlignment="center"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/add_info_layout_one_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/add_info_layout_one_img02"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="24dp"
android:src="@drawable/sample02" />
<TextView
android:id="@+id/add_info_layout_one_txtView02"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/add_info_txt_one_02"
android:textAlignment="center"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent" …Run Code Online (Sandbox Code Playgroud) 我想创建一些具有不同时间的警报,并在选择每个警报时将它们一个接一个地取消。我可以创建几个警报。但是我不知道如何选择它们。
目前,取消警报的程序正在处理我放置的最后一个警报。
这是我的工作
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.TimePicker;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity {
TimePicker myTimePicker;
Button buttonstartSetDialog;
Button buttonCancelAlarm;
TextView textAlarmPrompt;
Button buttonstartSetDialogOne;
Button buttonstartSetDialogTwo;
Button buttonstartSetDialogThree;
TextView textAlarmPromptOne;
TextView textAlarmPromptTwo;
TextView textAlarmPromptThree;
TimePickerDialog timePickerDialog;
int RQS_1 = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textAlarmPrompt = (TextView) findViewById(R.id.alarmprompt);
textAlarmPromptOne = (TextView) findViewById(R.id.alarmpromptOne);
textAlarmPromptTwo = (TextView) findViewById(R.id.alarmpromptTwo);
textAlarmPromptThree …Run Code Online (Sandbox Code Playgroud) java android alarmmanager android-pendingintent android-broadcastreceiver
java ×5
android ×4
jtable ×2
swing ×2
alarmmanager ×1
border ×1
jsp ×1
jsp-tags ×1
mysql ×1
random ×1
servlets ×1
sql ×1
tablecolumn ×1
tablemodel ×1
textview ×1