Struts2 Action is not called when more than 4 option given for file uploading - struts2

HTTP Status 404 - No result defined for action com.strutsProject.action.AchievementsAction and result input uploading
Struts2 Action is not call when more than 4 option given for file uploading
<div class="form-group">
<label for="email" class="col-sm-5 control-label" style=" text-align: left;">Upload Photo</label>
<div class="col-sm-7">
<input type="file"class="form-control" data-buttonName="btn-primary" name="fileUpload7" >
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-5 control-label" style=" text-align: left;">Upload Photo</label>
<div class="col-sm-7">
<input type="file"class="form-control" data-buttonName="btn-primary" name="fileUpload7" >
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-5 control-label" style=" text-align: left;">Upload Photo</label>
<div class="col-sm-7">
<input type="file" class="form-control" data-buttonName="btn-primary" name="fileUpload7" >
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-5 control-label" style=" text-align: left;">Upload Photo</label>
<div class="col-sm-7">
<input type="file"class="form-control" data-buttonName="btn-primary" name="fileUpload7" >
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-5 control-label" style=" text-align: left;">Upload Photo</label>
<div class="col-sm-7">
<input type="file"class="form-control" data-buttonName="btn-primary" name="fileUpload7" >
</div>
</div>

I found the solution ,i forget to include below part in struts.xml file if you have used below code do not include this(<param name="maximumSize">9097152</param> ) because this will override the below code
<constant name="struts.multipart.maxSize" value="104857600" />

Related

Bootstrap 5 - checkboxes are not lining up with labels

I am trying out Bootstrap 5 and am having difficulty lining up my checkboxes and their labels. The code is:
<div class="row col-lg-3 col-md-2 col-sm-2 col-xs-6">
<label class="col-lg-12 col-md-12 col-sm-12 col-xs-12" for="state"><b>Branch</b></label>
<div class="form-check">
<div class="checkbox">
<label>ACT</label>
<input type="checkbox" value="" id="act" name="state[]">
</div>
<div class="checkbox">
<label><input type="checkbox" value="" id="nsw" name="state[]">NSW</label>
</div>
<div class="checkbox">
<input type="checkbox" value="" id="nt" name="state[]">
<label>NT</label>
</div>
<div class="checkbox">
<label class="pull-right"><input type="checkbox" value="" id="qld" name="state[]">QLD</label>
</div>
<div class="checkbox">
<label class="pull-left"><input type="checkbox" value="" id="sa" name="state[]">SA</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" id="tas" name="state[]">TAS</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" id="vic" name="state[]">VIC</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" id="wa" name="state[]">WA</label>
</div>
</div>
</div>
And the result is:
As you can see I have tried three variations.
From the edited first answer - this results:
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class="col-lg-12 col-md-12 col-sm-12 col-xs-12" for="state"><b>Branch</b></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="act" name="state[]">
<label class="form-check-label">ACT</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="nsw" name="state[]">
<label class="form-check-label">NSW</label>
</div>
</div>
</div>
</div>
Gives:
I have tried adding:
.big-checkbox {
width: 30px;
height: 30px;
}
This just increases the height of the check (it is still long).
The "custom check" html composition is changed in Bootstrap 5. Now each checkbox should look the follows (along with parent containers):
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-2 col-sm-2 col-xs-6">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="act" name="state[]" />
<label class="form-check-label" for="act">ACT</label>
</div>
</div>
</div>
</div>
Bootstrap 5 Check CodePen

Passing Current Model to partial View, Handling Large from Server To Clients

i want to pass All Input values of View to My Partial View(Passing User Order to Show Order Summary) but all values got null in partial View Below is My Code.
Submit
<div id="myModal_#Model.CustRef" class="modal fade" role="dialog">
<div class="modal-dialog" style="position:absolute; left:10%;">
<!-- Modal content-->
<div class="modal-content" style="width:80vw;">
<div class="modal-header ">
<h4 class="modal-title"><i class="fas fa-shopping-cart"></i> Order Summary</h4>
<button type="button" class="close" data-dismiss="modal">Back</button>
</div>
<div class="modal-body">
...Disabled Inputs...
</div>
</div>
</div>
</div>
My Create Order View
<form asp-action="Create">
....
#*<partial name="~/Views/Order/OrderSummary.cshtml" model="Model" />*#
#await Html.PartialAsync("~/Views/Order/OrderSummary.cshtml", new OrderViewModel() { cus_name = Model.cus_name, cus_phone = Model.cus_phone, CustRef = Model.CustRef, Phoneid = Model.Phoneid, modelId = Model.modelId, Quantity = Model.Quantity, Address = Model.Address, CityId = Model.CityId, Date = Model.Date, store_id = Model.store_id })
</form>
Second Question
My Second Question is i have large data to pass to View(Admin Dashboard) to Complete Statistics but its taking too much time. Please tell me any other Efficient way to increase performance.
You need to pass the current input model to the controller through ajax and return
to render the new partial view.
Please refer to the following code:
Controller:
public class OrderController : Controller
{
public IActionResult Index()
{
OrderViewModel orderView = new OrderViewModel();
return View(orderView);
}
public PartialViewResult ShowParitalView(OrderViewModel orderView)
{
return PartialView("OrderSummary", orderView);
}
}
Index view:
#using WebApplication_core_mvc.Models;
#model OrderViewModel
#{
ViewData["Title"] = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
#section Scripts{
<script>
$(function () {
$("a").click(function () {
event.preventDefault();
$("div .modal").attr("id", "myModal_" + $("#cus_name").val());
$("a").attr("data-target", "#myModal_" + $("#cus_name").val());
$.ajax({
type: "POST",
url: "/Order/ShowParitalView",
data: $("form").serialize(),
success: function (data) {
$('#partial').html(data);
$("#myModal_" + $("#cus_name").val()).modal('show');
}
})
})
});
</script>
}
<form asp-action="Create">
<div class="form-group">
<label asp-for="cus_name" class="control-label"></label>
<input asp-for="cus_name" class="form-control" />
<span asp-validation-for="cus_name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="cus_phone" class="control-label"></label>
<input asp-for="cus_phone" class="form-control" />
<span asp-validation-for="cus_phone" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustRef" class="control-label"></label>
<input asp-for="CustRef" class="form-control" />
<span asp-validation-for="CustRef" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Phoneid" class="control-label"></label>
<input asp-for="Phoneid" class="form-control" />
<span asp-validation-for="Phoneid" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="modelId" class="control-label"></label>
<input asp-for="modelId" class="form-control" />
<span asp-validation-for="modelId" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Quantity" class="control-label"></label>
<input asp-for="Quantity" class="form-control" />
<span asp-validation-for="Quantity" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Address" class="control-label"></label>
<input asp-for="Address" class="form-control" />
<span asp-validation-for="Address" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CityId" class="control-label"></label>
<input asp-for="CityId" class="form-control" />
<span asp-validation-for="CityId" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Date" class="control-label"></label>
<input asp-for="Date" class="form-control" />
<span asp-validation-for="Date" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="store_id" class="control-label"></label>
<input asp-for="store_id" class="form-control" />
<span asp-validation-for="store_id" class="text-danger"></span>
</div>
<a href="#" data-toggle="modal" data-target="#myModal_#Model.CustRef"
style="border-radius: 1.5rem; margin-right:8%; margin-top: 1%; border: none;
padding:10px 2%; background: #0062cc; color: #fff; font-weight: 600; width:20%;
cursor: pointer; text-align:center; font-weight:bolder;">
Submit
</a>
<div id="myModal_#Model.CustRef" class="modal" role="dialog">
<div class="modal-dialog" style="position:absolute; left:10%;">
<!-- Modal content-->
<div class="modal-content" style="width:80vw;">
<div class="modal-header ">
<h4 class="modal-title"><i class="fas fa-shopping-cart"></i> Order Summary</h4>
<button type="button" class="close" data-dismiss="modal">Back</button>
</div>
<div class="modal-body">
<div id="partial">
</div>
</div>
</div>
</div>
</div>
</form>
OrderSummary Partial View:
#using WebApplication_core_mvc.Models;
#model OrderViewModel
<div class="form-group">
<label asp-for="cus_name" class="control-label"></label>
<input asp-for="cus_name" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="cus_phone" class="control-label"></label>
<input asp-for="cus_phone" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="CustRef" class="control-label"></label>
<input asp-for="CustRef" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="Phoneid" class="control-label"></label>
<input asp-for="Phoneid" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="modelId" class="control-label"></label>
<input asp-for="modelId" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="Quantity" class="control-label"></label>
<input asp-for="Quantity" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="Address" class="control-label"></label>
<input asp-for="Address" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="CityId" class="control-label"></label>
<input asp-for="CityId" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="Date" class="control-label"></label>
<input asp-for="Date" class="form-control" disabled/>
</div>
<div class="form-group">
<label asp-for="store_id" class="control-label"></label>
<input asp-for="store_id" class="form-control" disabled/>
</div>
Here is the result:
For the second question, there are too many SQL query statements in your code, you can try to improve performance by referring to this.

in Bootstrap 4, textbox form-control width is not working. the textbox does not appear in full-width. I'm using asp.net mvc 5

<div class="row">
<div class="col-md-6 my-3">
<div class="card card-outline-secondary">
<div class="card-body">
<form class="form" role="form" autocomplete="off">
<div class="form-group row">
<label class="col-md-3 col-form-label form-control-label">First Name</label>
<div class="col-md-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Last name</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Middle name</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Name Extension</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Date of Birth</label>
<div class="col-lg-9">
<input class="form-control" type="date" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Gender</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label"></label>
<div class="col-lg-9">
<input type="reset" class="btn btn-secondary" value="Cancel">
<input type="button" class="btn btn-primary" value="Save Changes">
</div>
</div>
</form>
</div><!-- card body -->
</div> <!-- card-outline -->
</div>
</div>
I want to make the textbox appear in full-width. I did my research and found out that the width is in default to appear in full-width but in my work it appears in a fixed size.
Your <form> is nested inside the card;
Your card is nested inside col-md-6 of the row;
Hence on media(min-width: 992px), your form-controls will only get
1/2 * 9/12 = 37.5% of the full width.
Your form labels and inputs are already using full width of the card. The problem is, the card is not using full width of the container.
To fix that, you can either remove <div class="row"> and <div class="col-md-6 my-3"> completely, or just change <div class="col-md-6 my-3"> to <div class="col-md-12 my-3">
Fiddle: http://jsfiddle.net/aq9Laaew/86873/
You need to define parent div with full with
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12 my-6">
<div class="card card-outline-secondary">
<div class="card-body">
<form class="form" role="form" autocomplete="off">
<div class="form-group row">
<label class="col-md-3 col-form-label form-control-label">First Name</label>
<div class="col-md-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Last name</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Middle name</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Name Extension</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Date of Birth</label>
<div class="col-lg-9">
<input class="form-control" type="date" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label">Gender</label>
<div class="col-lg-9">
<input class="form-control" type="text" value="" readonly />
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label form-control-label"></label>
<div class="col-lg-9">
<input type="reset" class="btn btn-secondary" value="Cancel">
<input type="button" class="btn btn-primary" value="Save Changes">
</div>
</div>
</form>
</div><!-- card body -->
</div> <!-- card-outline -->
</div>
</div>
</div>
</body>
</html>
Try adding this to your css:
input, select, textarea {max-width: 100% !important;}

bootstrap Form Layout --horizontal with labels on top

I am just trying to have a horizontal form with labels on top. keep in mind I am going to add validation so grouping is important
I am looking for something like this
Name email ID
Mike Mike#hotmail.com something
code
<div class="col-lg-12">
<div class="row">
<div class="page-content">
<div class="panel panel-primary">
<form name="searchform" role="form" >
<fieldset>
<legend></legend>
<div class="form-horizontal">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
<div class="form-horizontal">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-horizontal">
<label for="exampleInputPassword1">Employee ID</label>
<input type="text" class="form-control" id="exampl">
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
this worked for me...let me know if there is a better solution
<form name="searchform" role="form" novalidate>
<fieldset>
<legend></legend>
<div class="col-lg-12">
<div class="row">
<div class="form-group col-xs-3 col-md-3">
<label for="Name" class="control-label"> Name</label>
<input type="text" value='' class="form-control" id="Name" placeholder="Name">
</div>
<div class="form-group col-xs-3 col-md-3">
<label for="associateID" class="control-label">Associate ID</label>
<input type="text" value='' class="form-control" id="associateID" placeholder="Associate ID">
</div>
<div class="form-group col-xs-3 col-md-3">
<label for="ID" class="control-label">ID</label>
<input type="text" value='' class="form-control" id="ID" placeholder="Racf ID">
</div>
<div class="form-group col-xs-3 col-md-3">
<label for="Role" class="control-label">Gateway Role</label>
<p-autoComplete [(ngModel)]="RoleVal" [suggestions]="iRole" name="gatewayRole" placeholder="Gateway Role" (completeMethod)="searchRole($event)" [style]="{'width':'85%'}" [inputStyle]="{'width':'85%'}" field="name" dataKey="id" [dropdown]="true"></p-autoComplete>
</div>
</div>
<div class="row">
<div class="form-group col-xs-3 col-md-3">
<label for="Name" class="control-label">Location</label>
<input type="text" value='' class="form-control" id="Name" placeholder=" Name">
</div>
<div class="form-group col-xs-3 col-md-3">
<label for="associateID" class="control-label">Associate ID</label>
<input type="text" value='' class="form-control" id="associateID" placeholder="Associate ID">
</div>
<div class="form-group col-xs-3 col-md-3">
<label for="racfID" class="control-label">ID</label>
<input type="text" value='' class="form-control" id="ID" placeholder="ID">
</div>
<div class="form-group col-xs-3 col-md-3">
<label for="gatewayRole" class="control-label">Role</label>
<p-autoComplete [(ngModel)]="RoleVal" [suggestions]="iRole" name="Role" placeholder="Role" (completeMethod)="searchyRole($event)" [style]="{'width':'85%'}" [inputStyle]="{'width':'85%'}" field="name" dataKey="id" [dropdown]="true"></p-autoComplete>
</div>
</div>
</div>
</fieldset>
</form>

View can not find model class that is in another project

I have two project in my solution. One of my project is a class library that I want to use as models while other one is mvc 4 web application project. Now when I send my model to my partial view from my controller my view does not render and gives the error that it could not find the class and the assembly containing the class is missing however i have added the assembly reference of my class library to the mvc project.
I need to ask that is it necessary in MVC project to have models in the same project? or I am doing something wrong
#using TransactionManagment.Entities;
#{
ViewBag.Title = "D&C | User Admin";
Layout = "~/Views/Shared/MasterPageLTE.cshtml";
}
#{
var usr = (AppUser)ViewBag.User;
var usrRights = usr.AppUserRights.AllUserPossibleRights;
}
<style>
.mytabs {
font-weight: bold;
color: cadetblue;
}
</style>
<script>
function IsSuperUser() {
if (document.getElementById('chkSuperUser').checked) {
document.getElementById('tab_user_rights').style.display = 'none';
} else {
document.getElementById('tab_user_rights').style.display = 'inline';
}
}
</script>
<div class="row">
<div class="col-md-12">
<!-- Custom Tabs -->
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="mytabs active">Users</li>
<li class="mytabs" id="tab_user_rights">User Rights</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_1">
<div class="">
<!-- form start -->
<form role="form">
<div class="box-body">
<div class="form-group">
<label>Select</label>
<select class="form-control">
<option>New User</option>
<option>option 2</option>
<option>option 3</option>
<option>option 4</option>
<option>option 5</option>
</select>
</div>
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" id="txtFirstName" placeholder="First Name">
</div>
<div class="form-group">
<label>Last Name</label>
<input type="text" class="form-control" id="txtLastName" placeholder="Last Name">
</div>
<div class="form-group">
<label>Designation</label>
<input type="text" class="form-control" id="txtDesignation" placeholder="Enter email">
</div>
<div class="form-group">
<label>Date of Birth</label>
<input type="date" class="form-control" id="txtDateofBirth" placeholder="Date of Birth">
</div>
<div class="form-group">
<label>Email address</label>
<input type="email" class="form-control" id="txtEmailAdd" placeholder="useremail#domain.com">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" id="txtPassword" placeholder="Password">
</div>
<div class="form-group">
<label>Picture</label>
<input type="file" id="txtPicture">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="chkSuperUser" onchange="IsSuperUser();"> Super User
</label>
</div>
</div><!-- /.box-body -->
</form>
</div>
</div><!-- /.tab-pane -->
<div class="tab-pane" id="tab_2">
#foreach (var upr in usrRights)
{
foreach (var right in upr.Actions)
{
<label class="">
<div class="icheckbox_minimal-blue checked" aria-checked="true" aria-disabled="false" style="position: relative;">
<input id="#{'.'+right}" type="checkbox" class="minimal" checked="" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"></ins>
</div>
</label>
}
}
<h4>#{usr.UserName}</h4>
</div><!-- /.tab-pane -->
<div class="box-footer">
<button type="submit" class="btn btn-primary" id="btn_addUser">Save User</button>
</div>
</div><!-- /.tab-content -->
</div><!-- nav-tabs-custom -->
</div>
</div>
Controller
namespace TransactionManagmentWeb.Controllers
{
public class UserAdministrationController : Controller
{
//
// GET: /UserAdministration/
public ActionResult UserAdministrationHome()
{
AppUser user = new AppUser {AppUserRights = new AppUserRights()};
return PartialView(user);
}
}
}
Error
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'TransactionManagment' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 1:
Line 2: #using TransactionManagment.Entities;
Line 3:
Line 4:
You might need to add in your view markup
#using theothernamespace.Models

Resources