Requirement of JSTL when studying Java EE
Does I need to study JSTL in java EE. I'm studying java EE, does studying JSTL gives any advantage if it is not a part of java EE. Thanks in advance.
See also questions close to this topic
-
Can searchResponse.getHits().getHits(); throw nullpointer exception
We are getting a nullpointerexception at searchResponse.getHits().getHits(); I'm totally new to elastic search and don't know how it works but need to analyse this issue.
Let me know if it throws nullpointerexception in any case ? If it throws how to handle this ?
-
Is it possible to disable SSL certificate checking in the amazon kinesis consumer library v2?
When developing a Kinesis Consumer using Version 2 of the Kinesis Consumer Library and overriding the Dynamo DB endpoint to a localstack endpoint the library fails to create the leasing table due to SSL handshake errors.
I can confirm that creating the table succeeds when using AWS' Dynamo DB, but as soon as I override the endpoint url to a localstack url the Dynamo DB client fails to create the lease table after multiple retries. The stack trace isn't that useful but Wireshark shows all of the SSL handshake errors so I can only assume the Amazon SDK is not accepting the localstack certificate. I cannot find any mention of how to disable certificate verification using the
software.amazon.awssdk
package.Region region = Region.of("us-east-1"); DefaultCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create(); DynamoDbAsyncClient dynamoClient = DynamoDbAsyncClient.builder() .region(region) .endpointOverride(URI.create("https://localhost:4569")) .credentialsProvider(credentialsProvider) .build();
/edit This is based off the example from Amazon found here: https://docs.aws.amazon.com/streams/latest/dev/kcl2-standard-consumer-java-example.html
-
Problem creating an OracleDataSource correctly from tomcat context.xml
In the project im working at the following problem occurs:
We use Database connections defined in our tomcat context.xml. For now this has worked without problems.
Example:
<Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" logAbandoned="true" maxIdle="10" maxTotal="100" maxWaitMillis="5000" name="NAME" password="PASSWORD" removeAbandonedOnMaintenance="true" removeAbandonedTimeout="60" type="javax.sql.DataSource" url="URL" username="USERNAME" />
This type of resource definition is used in the webapp for every database connection, retreiving the datasource like this:
InitialContext ctx = new InitialContext(); DataSource dsAux = (DataSource) ctx.lookup(dbCon);
The problem begins here. Oracle queues are being used with jms (Java Message System) for a lot of processes. For this, as it is coded right now, we need an OracleDataSource that can be created having only the db url, password and username.
My question is, is it possible in any way or form to get all the data needed from the context for this type of datasource correctly? I have tried changing the datasource type without any luck, unwrapping the already created datasource to try and create an OracleDataSource, in the end, the only possible solution I have come up with is to change how database connections are saved.
-
How can i get my table values from html to servlet?
I need to get my html table values in my servlet
Hi,
Im doing a project during my acadamic courses about sudoku website.
During my project I have encounterd a problem that I can't slove - get my table html values into my servlet. I have tried doing things like set hidden names and getParameterValues but none of them worked.
this is my html table
<table class="center"> <% int n =9; for(int s = 0; s<n; s++){ %> <tr> <% for(int f=0; f<n; f++) { %> <td><% int z = SF[s][f]; if(z==0) {%> <input type="text"> <% } else { %> <%=SF[s][f]%> <%}%> </td hidden name="z"> <% } %> </tr hidden name="z"> <% } %> </table>
and this is my empty servlet
package View; import org.omg.CORBA.SystemException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet(name = "CheckSudokuServlet",urlPatterns = "/CheckSudokuServlet") public class CheckSudokuServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); //tried - String td[]=request.getParameterValues("z"); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
-
Spring MVC program to upload and display the uploaded record in jsp page
I am newbie to Spring MVC. I had an immediate task to upload text/csv file and read the records and display in jsp page there itself. I am not getting proper resources to read, Please help me on it finding me the right resource or with your coding Thanks in advance
-
How can I load an URL in DataBase when I have a MultipartFile?
I have to upload an IMG in my form. I setted the file as String so I get an Invalid Format. How can I convert the file to String? Where am I doing wrong?
I'm using mySQL, Servlet, JSP, Spring, Hibernate.
package it.si2001.model; import javax.persistence.*; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.Type; import org.hibernate.validator.constraints.NotEmpty; import org.joda.time.LocalDate; import org.springframework.format.annotation.DateTimeFormat; import java.util.HashSet; import java.util.Set; @Entity @Table(name="employee_tab") public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name="document_link_str") private String documentLinkStr; @Size(min=2, max=50) @Column(name = "first_name", nullable = false) private String firstName; @Size(min=2, max=50) @Column(name = "last_name", nullable = false) private String lastName; @Size(min=3, max=15) @Column(name = "mobile_no", nullable = false) private String mobileNo; @NotNull @DateTimeFormat(pattern="yyyy-MM-dd") @Column(name = "birth_date", nullable = false) @Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDate") private LocalDate birthDate; @NotEmpty @Column(name = "ssn", unique=true, nullable = false) private String ssn; @ManyToOne @JoinColumn(name = "status_id") private Status status; @ManyToMany(cascade = CascadeType.REFRESH,fetch=FetchType.EAGER) @Fetch(FetchMode.SELECT) @JoinTable(name = "emp_emp_skill", joinColumns = { @JoinColumn(name = "employee_id") }, inverseJoinColumns = { @JoinColumn(name = "skill_id") }) private Set<Skill> skills = new HashSet<Skill>(); public int getId() { return id; } public void setId(int id) { this.id = id; } public String getDocumentLinkStr() { return documentLinkStr; } public void setDocumentLinkStr(String documentLinkStr) { this.documentLinkStr = documentLinkStr; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getMobileNo() { return mobileNo; } public void setMobileNo(String mobileNo) { this.mobileNo = mobileNo; } public LocalDate getBirthDate() { return birthDate; } public void setBirthDate(LocalDate birthDate) { this.birthDate = birthDate; } public String getSsn() { return ssn; } public void setSsn(String ssn) { this.ssn = ssn; } public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public Set<Skill> getSkills() { return skills; } public void setSkills(Set<Skill> skills) { this.skills = skills; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + id; result = prime * result + ((ssn == null) ? 0 : ssn.hashCode()); return result; }//close hashCode @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Employee)) return false; Employee other = (Employee) obj; if (id != other.id) return false; if (ssn == null) { if (other.ssn != null) return false; } else if (!ssn.equals(other.ssn)) return false; return true; }//close equals @Override public String toString() { return "Employee{" + "id=" + id + ", documentLinkStr='" + documentLinkStr + '\'' + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", mobileNo='" + mobileNo + '\'' + ", birthDate=" + birthDate + ", ssn='" + ssn + '\'' + ", status=" + status + ", skills=" + skills + '}'; }//close toString }//close class
This is my Controller:
/*This method will provide the medium to add a new employee.*/ @RequestMapping(value = {"/new"}, method = RequestMethod.GET) public String newEmployee(ModelMap model) { Employee employee = new Employee(); model.addAttribute("employee", employee); model.addAttribute("edit", false); return "registration"; }//close newEmployee /*This method will be called on form submission, handling POST request for saving employee in database. It also validates the user input */ @RequestMapping(value = {"/new"}, method = RequestMethod.POST) public String saveEmployee(@Valid Employee employee, BindingResult result, ModelMap model, FileUpload fileUpload) throws IOException { /* BindingResult contains the outcome of this validation and any error that might have occurred during this validation.*/ if (result.hasErrors()) { return "registration"; } /*Before saving/updating an employee, we are checking if the SSN is unique.If not, we generate validation error and redirect to registration page.*/ if (!employeeService.isEmployeeSsnUnique(employee.getId(), employee.getSsn())) { FieldError ssnError = new FieldError("employee", "ssn", messageSource.getMessage("non.unique.ssn", new String[]{employee.getSsn()}, Locale.getDefault())); result.addError(ssnError); return "registration"; }//close saveEmployee MultipartFile multipartFile = fileUpload.getFile(); //Now do something with file... String UPLOAD_LOCATION = "C:/test/"; FileCopyUtils.copy(fileUpload.getFile().getBytes(), new File(UPLOAD_LOCATION + fileUpload.getFile().getOriginalFilename())); String fileName = multipartFile.getOriginalFilename(); employeeService.saveEmployee(employee); model.addAttribute("documentLinkStr", fileName); System.out.println("TEST filename: " + fileName); model.addAttribute("success", "Employee " + employee.getFirstName() + " registered successfully"); return "success"; }//close saveEmployee
This is my jsp:
<div class="form-container"> <div class="row"> <div class="form-group col-md-12"> <label class="col-md-3 control-lable" for="file">Upload a file</label> <div class="col-md-7"> <form:input type="file" path="file" id="file" class="form-control input-sm"/> <div class="has-error"> <form:errors path="file" class="help-inline"/> </div> </div> </div> </div>
When I run the project and compile the form I get "Invalid Format".
-
how to load servlet from main method
I have Main class, there I doing api request and integrate with database. I also create servlet where I want to get data from clients and put it in database. it is the main method in Main class:
public static void main(String[] args) throws IOException { serverSocket = new ServerSocket(8888); // Server port System.out.println("Server started. Listening to the port 8888"); initProviderList(); initNewsAppDB(); Thread newFeedsUpdate = new Thread(new NewFeedsUpdate(providerList)); newFeedsUpdate.start(); }
it is the servlet:
@WebServlet(name = "GetClientTokenServlet") public class GetClientTokenServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String token = request.getParameter("token"); System.out.println(token); }
web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> <servlet> <servlet-name>GetClientTokenServlet</servlet-name> <servlet-class>GetClientTokenServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>GetClientTokenServlet</servlet-name> <url-pattern>/GetClientTokenServlet</url-pattern> </servlet-mapping> </web-app>
how I can setup the GetClientTokenServlet (to be able listen to clients calls) into main method?
-
How to change DefaultSessionTrackingModes when HttpsSession is created
I want to change DefaultSessionTrackingModes when any HttpSession is created on basis of Login User
So for that, I have created my own HttpSessionListner
@WebListener public class HttpSession1TrackingModeSetter implements HttpSessionListener { /* * (non-Javadoc) * * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent) */ @Override public void sessionCreated(final HttpSessionEvent hse) { hse.getSession().getServletContext().getDefaultSessionTrackingModes(); System.out.println("Session is created" + hse.getSession().getId()); if(/*Curr*/){ // Default Session URL }else{ // Defualt Session Cookie } } /* * (non-Javadoc) * * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent) */ @Override public void sessionDestroyed(final HttpSessionEvent hse) { System.out.println("sessionDestroyed is created" + hse.getSession().getId()); } }
So is there any way to change the Default Session Tracking Mode
Thanks in advance, Vishal
-
NoClassDefFound for SLF4J Logger in Glassfisj Environment
I have a Webservlet which has (not injects) a Logger:
import org.slf4j.Logger; @WebServlet("/processForm") public class TestServlet extends HttpServlet { private Logger logger;
I have a dependency :
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.25</version> </dependency>
and I can see the Logger Interface in the External Libraries of my IntelliJ IDE.
When starting Glassfish I get:
Exception while loading the app : CDI deployment failure:Error while loading class theapplication.servlets.TestServlet org.jboss.weld.resources.spi.ResourceLoadingException: Error while loading class theapplication.servlets.TestServlet at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:183) at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:191) at org.jboss.weld.manager.BeanManagerImpl.createAnnotatedType(BeanManagerImpl.java:1118) at org.glassfish.weld.WeldDeployer.firePITEvent(WeldDeployer.java:403) at org.glassfish.weld.WeldDeployer.fireProcessInjectionTargetEvents(WeldDeployer.java:374) at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:226) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131) Caused by: java.lang.NoClassDefFoundError: Lorg/slf4j/Logger; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2583) at java.lang.Class.getDeclaredFields(Class.java:1916) at org.jboss.weld.annotated.slim.backed.SecurityActions.getDeclaredFields(SecurityActions.java:49) at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.computeValue(BackedAnnotatedType.java:182) at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.computeValue(BackedAnnotatedType.java:176) at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:46) at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:159) at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.<init>(BackedAnnotatedType.java:176) at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.<init>(BackedAnnotatedType.java:176) at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:65) at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:47) at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:81) at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:76) at org.jboss.weld.util.cache.ReentrantMapBackedComputingCache.lambda$null$0(ReentrantMapBackedComputingCache.java:55) at org.jboss.weld.util.WeakLazyValueHolder$1.computeValue(WeakLazyValueHolder.java:35) at org.jboss.weld.util.WeakLazyValueHolder.get(WeakLazyValueHolder.java:53) at org.jboss.weld.util.cache.ReentrantMapBackedComputingCache.getValue(ReentrantMapBackedComputingCache.java:72) at org.jboss.weld.util.cache.ReentrantMapBackedComputingCache.getCastValue(ReentrantMapBackedComputingCache.java:78) at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:174) ... 46 more Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1621) at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1471)
I have no clue why. Any help/hint ?
-
Log4j2 custom Filter xml to property file
Created the custom filter by extending AbstractFilter. Created log4j2.xml as per below code
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="WARN" monitorInterval="30" packages="com.smp.marker"> <Properties> <Property name="DEFAULT_LOG_PATTERN">%d %-5p %m%n [:%L]</Property> </Properties> <Appenders> <Console name="CLOG" target="SYSTEM_OUT"> <PatternLayout alwaysWriteExceptions="false" pattern="%d %-5p [%c{5}.%M():%L] %m%n" /> <Filters> <SmpClogAppenderFilter level="ALL" onMatch="ACCEPT" onMismatch="DENY"/> </Filters> </Console> <Console name="DEFAULT" target="SYSTEM_OUT"> <PatternLayout alwaysWriteExceptions="false" pattern="${DEFAULT_LOG_PATTERN}" /> <Filters> <SmpClogAppenderFilter level="ALL" onMatch="DENY" onMismatch="ACCEPT"/> </Filters> </Console> </Appenders> <Loggers> <Root level="info"> <AppenderRef ref="CLOG" /> <AppenderRef ref="DEFAULT" /> </Root> </Loggers> </Configuration>
This is working as expetced. But in our project we need log4j2.properties. Unable to create the property file with custom filter.Mainly need propety value for filter section.
<Filters> <SmpClogAppenderFilter level="ALL" onMatch="ACCEPT"
onMismatch="DENY"/>
Could some one please help me to resolve this issue.
-
How to assign URL parameter as value for parameter in sql update?
I'm looking to insert data into a table called items in my database. The page I am currently working on receives parameters from the previous page. I am trying to assign these to the JSTL SQL tags but I do not know how to do so.
I've only managed to find examples where the value assigned to the sql param is a value created from text input on the same page.
val1 and val2 are parameters which come from a http GET request on the previous page. Below is segment which my problem is referring to
<sql:setDataSource var = "db1" driver = "com.mysql.jdbc.Driver" url = "jdbc:mysql://localhost/project" user = "user1" password = "test1"/> <sql:update dataSource = "${db1}" var="result"> INSERT INTO items (val1, val2) VALUES(?, ?) <sql:param value="" /> ######## parameter value should be assigned here <sql:param value="" /> </sql:update>
On the previous page, the part which sends the two values is:
<form action="list.jsp" method="GET"> <input type = "hidden" name = "val1" value = "${row.val1}" /> <input type = "hidden" name = "val2" value = "${row.val2}" /> <input type = "submit" value = "Add to table" /> </form>
-
Populate JSP table with JSTL forEach Loop
My program takes an email from input, and uses the haveibeenpwned API to show the user all the breaches found from that email.
I'm wondering how I can get my
forEach
loop to populate a table properly. Currently, it just populates every item into one table row with the table header below the data. I would like the header to be on top, and each breach to be in a separate table row.Here is my .jsp form showing the table and
forEach
:<table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">Breach</th> </tr> </thead> <tbody> <c:forEach var="breach" items="${breaches}" varStatus="status"> <tr> <th scope="row">${status.count}</th> <td><p>${breach}</p></td> </tr> </c:forEach> </tbody> </table>
Here is my servlet where I get an ArrayList of found breaches:
String json = callPwnedApi(email); if (json.startsWith("{") || json.startsWith("[")) { Gson gson = new Gson(); ArrayList<Breach> breaches = gson.fromJson(json, new TypeToken<ArrayList<Breach>>(){}.getType()); if (!breaches.isEmpty() && breaches.size() > 0) { request.setAttribute("breaches", breaches); } }
-
Display JSP Table using JSTL while iterating multiple objects
I am actually still a starter in this java ee stuff, and I have managed to get quite far still..
I will try to explain my problem the simplest way I can so bear with me.. :)
I am using my Servlet "MajTablesController.java" to retrieve object info ( name, ref etc.. ) from multiple objects [ The Goal is to show a Table that gathers all of this information into one object ]
Using the same servlet i Send a List as a Session Attribute named " Resultat " which contains itself list of the different objects mentionned before.
So to sum up, My List Resultat ( which is received by my JSP ) contains 4 ListObjects.
The problem is when creating the table, i need to use multiple loops in order to retrieve the data from the different objects, no matter how i place the forEach tags, i can't manage to get the table the right way ( see pics ), and I end up either getting all of the info in one line or one column...
To help you visualise more clearly what is happening, here is an example of what i Am getting with this code :
Code:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.estia.tai.UsersBeanModel"%> <%@ page import="com.estia.tai.EchantillonBeanModel"%> <%@ page import="java.sql.*"%> <%@ page import="com.estia.tai.BDDConnect"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <link rel="stylesheet" type="text/css" media="screen" href="../css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" media="screen" href="../css/styles.css"> <script src="../js/scripts.js"></script> <script src="https://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script> <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.13.4/dist/bootstrap-table.min.css"> <script src="https://unpkg.com/bootstrap-table@1.13.4/dist/bootstrap-table.min.js"></script> <head> </head> <div class="container-fluid"> <div class="col-md-12"> <div class="table-responsive table-dark" id="preptable"> <table class="table table-bordered table-hover text-center" data-toggle="" data-search="false" data-filter-control="true" data-show-export="true" data-click-to-select="true"> <thead> <tr class=""> <th data-field=id data-filter-control="select" data-sortable="true">Id Commande</th> <th data-field=echantillons data-filter-control="select" data-sortable="true">Echantillons</th> <th data-field=conditionnement data-filter-control="select" data-sortable="true">Conditionnement</th> <th data-field=transporteur data-filter-control="select" data-sortable="true">Transporteur</th> <th data-field=etat data-filter-control="select" data-sortable="true">Etat</th> <th data-field=date data-filter-control="select" data-sortable="true">Date</th> <th data-field=client data-filter-control="select" data-sortable="true">Clientss</th> </tr> </thead> <tbody> <c:forEach items="${Resultat}" var="variable"> <tr> <td><a href="../CommandeVueController?id=${variable.id}">${variable.id}</a></td> <td>${variable.echantillonRef}</td> <td>${variable.conditionnement}</td> <td><a href="../TransporteurVueController?id=${variable.transporteurId}">${variable.transporteur}</a></td> <td>${variable.etat}</td> <td>${variable.date}</td> <td>${variable.client}</td> </tr> </c:forEach> </tbody> </table> </div> <!--end of .table-responsive--> <script> var $table = $('#preptable'); $(function() { $('#toolbar').find('select').change(function() { $table.bootstrapTable('refreshOptions', { exportDataType : $(this).val() }); }); }) var trBoldBlue = $("preptable"); $(trBoldBlue).on("click", "tr", function() { $(this).toggleClass("bold-blue"); }); $(document) .ready( function() { td_array = document .getElementsByTagName("td"); check_prep = "En preparation"; for (i = 0; i < td_array.length; i++) { if (td_array[i].textContent == check_prep) { td_array[i].style.backgroundColor = "#FF8C00"; } ; } ; }); </script> </div> </div>
TablePrep.jsp What it actually shows :https://screenshotscdn.firefoxusercontent.com/images/2e48ceaf-3cd6-422a-a21c-b01d215b5d0e.png
The Goal is to have each item of the lists below have its own Row ( just like a table )
Notice that the prepTable methods ( which gather and coordinate info from other objects ) sends Lists in their getters methods, which explains why we have lists in the table.
!ServletSide
BDDConnect connexionBDDModele = new BDDConnect(); Connection connection = connexionBDDModele.getConnexion(); List<PrepTableVueModel> prepTableList = new ArrayList<PrepTableVueModel>(); int TransporteurId = 0; if (request.getSession().getAttribute("p") == "p") { PrepTableVueModel prepTable = new PrepTableVueModel(); //request.getSession().setAttribute("commandeResultat", CommandeDAOModel.lireList()); //request.getSession().setAttribute("echantillonResultat", EchantillonDAOModel.lireListe()); //request.getSession().setAttribute("conditionnementResultat", ConditionnementDAOModel.lireListe()); //request.getSession().setAttribute("clientResultat", ClientDAOModel.lireListe()); //request.getSession().setAttribute("transporteurResultat", TransporteurDAOModel.lireListe()); prepTable.addCommande(CommandeDAOModel.lireList()); for (int i = 0 ; i < CommandeDAOModel.lireList().size(); i++) { prepTable.addEchantillon(EchantillonDAOModel.lireListeEch(CommandeDAOModel.lireList().get(i).getId())); } for (int i = 0 ; i< prepTable.EchantillonList.size(); i++) { prepTable.addEchantillonRef(EchantillonDAOModel.lireListeEchFinal(prepTable.EchantillonList.get(i))); } for (int i =0; i < prepTable.EchantillonListRef.size(); i++) { } //prepTable.addConditionnement(ConditionnementDAOModel.lireListe()); //prepTable.addClient(ClientDAOModel.lireListe()); //prepTable.addTransporteur(TransporteurDAOModel.lireListe()); System.out.println(prepTable.getId() + "id dans le maj "); System.out.println(prepTable.getEchantillon() + "ech dans le maj "); prepTableList.add(prepTable); request.getSession().setAttribute("Resultat", prepTableList); request.getRequestDispatcher("/panel/tableprep.jsp").forward(request, response);
I have tried to, Instead of returning Lists of elements from PrepTable, to return individual elements but without success..