Add.jsp and Update.jsp or only one - java

How many JSPs to create to maintain one table for data entry. Add.jsp to enter a new record and Update.jsp to update an already entered record. Is this a good idea or create only one jsp and use that for add and update using some parameter as all the fields and functionality remains same. Only difference is at the time of update few fields will be disabled and you need to pre-populate the form. I can use struts or jsf to develop this.

Better use one page, and differentiate between new and existing based on some criteria - for example, if the id of the object is 0.
Even if you make two pages, you can include the common content so that you don't copy-paste.

I like the one page approach too.
You could have a dropdown box containing the ids' or some other value that provides an easy way for the user to find a specific record and whatever other html elements you need on the page for displaying a record.
They make a choice using the drop down box if they wish to edit a record and then that records data is displayed on the page for editing, the user enters the corrections and hits the submit button.
If they want to enter a new record, then they do not make a choice using the dropdown box and instead just fill in the fields on the page and hit submit.
When posting back to the page you can check and see if a selection was made using teh dropdown box and if not enter a new record and if a choice was made then you update the record that corresponds to the selection made from the dropdown box.

Related

change table based on selected value from database in JSP

I need to change the values displayed in the timetable based on the room I select from the dropdown list but I don't know how to do it.
The code for dropdown list is:
select option list
And on the same page, the code for the timetable:
timetable JSP page
Right now it shows all values from the database regardless of the selected room.
AJAX(Asynchronous Javascript and XML) can do this for you. AJAX allows for the updating of contents within an HTML object without reloading the page. W3Schools and the JQuery reference both have lots of helpful info on the matter.

Can you use an IF function within a Gsheets data validation dropdown menu

I have a list of items within a drop down on Gsheets.
I'd the default to be blank, and if another cell says 'Pending', I'd like the dropdown to automatically also say 'Pending'.
I'd also then like the user to be able to change the item with another option in the list.
I've tried choosing a data range with the function under data validation.
Basically I'd like the dropdown choices to be:
=IF(A2="Pending", "Pending", "")
In Progress
Done
Is this possible within Gsheets, or even using App Script?
I'd like the cell to default to blank, then change to pending based off another cell saying pending.
At the moment it doesn't seem to be dynamic in the sense that it updates when the chosen cell says Pending.

Oracle ADF stop validation on empty table row, validate in popup form instead

I'm currently developing a simple application which does crud operations on a few tables.
It looks like this:
I have a problem with the add item form, invoked by pressing the button saying "Nova jedinica mjere". It opens a popup containing an ADF form as follows:
As you can see it does a create insert operation on popup fetch event, creating an empty row. When I fill the form with data, and press OK(the ok button is handled in the bean, doing a commit operation), I get an empty error message as follows:
This only happens if the table is editable(consisting of input text elements). If it is set to click to edit, this problem does not occur. How can I make validation only occur on form fields?
If you need any more info, please let me know because I too am new to adf.
EDIT:
This is the page in question:(posted as a pastebin link to not take up much space).
http://pastebin.com/5TKyPxEs
The form in the popup is a static region from a task flow with a method call and a page:
http://pastebin.com/9h69fRW4
You mean to say that when you enter the value in the form and Click OK, it should be there in the Table,If so, the values are not getting displayed in Table. It means your Iterator is not fetching the values. You have to Refresh your Iterator, VO and Table Compoent through Bean. So that the values in the form once you click OK, it will be there in the Table.

Struts 2 - How to populate a combobox considering another combobox choice

I would like to know what I am doing wrong or if I am on the wrong track, trying something impossible.
In my jsp I have two s:select and some textfields. Considering the choice of the first one I have to go search some informations on my database. What I am trying to do is everytime I choose some option in my first combobox I call a method im my action, this method get the informations I need from my mysql and populate my list(this list is the options of the second combobox), but of course this is not working because I am not reloading my jsp, the problem is that I cannot reload because I don't want to lose the information I have in the textfields.
I appreciate any kind of help.
you'd better use Ajax to load the data for your first ComboBox or some other fields data (page without re-loading,thus)

Struts 1.x Java- form data gets lost

My problem is, I have a jsp page(say one.jsp) which contains fields(eg: name, city etc) and after I hit on submit button, a new jsp(two.jsp) is opened in a new tab it contains a radio button 'I accept'. when the user now clicks on this radio button, the business logic should get executed. But the problem is the form values of one.jsp(values of name, city etc) are lost.
opening of the new jsp page using window.open is not a new request to the server. I wonder why the form values are lost.
Since you are using Struts 1 ,Please make sure you declare the fields whose values are to be retained in the ActionForm of the "I Accept" action and do set the values as Form2.setName(Form1.getName());
Or You have to maintain these values as hidden fields in two.jsp.
I guess the above two points would help you !
You are going from from one jsp to another jsp.But form values processed from one jsp to another jsp only>but you are expecting that values to submit form.
So you can do one thing you have get that values using request.getParameter();
and then you have to set that values to which you need.

Categories

Resources